Back to Top

helping master

A collection of generic Javascript functions that help in day to day programming.

empty(value)

Check if a variable|array|object|etc is empty|null|undefined|etc. A full list of what this function considers to be null can be seen in the tests of the Helping project.

Parameters

Name Type Description
value

Returns

boolean

A boolean that states if the parsed in value is considered empty.

each(obj, callback)

Iterate over an Object|Array and return the key and value of each property.

  • Doesn't iterate over prototypes.
  • Loops can be broken with "return false".

This was developed to overcome some of the shortcomings of other methods: https://codepen.io/SeanBannister/pen/qOoLrm

This code is a modified version of jQuery 3.5.0's $.each

Parameters

Name Type Description
obj Object Array

An object we'll iterate over.

callback function(number|string, *)

Returns a key (index) and a value.

Returns

Void