Utils

Utility functions
 avatarppSan
Public2 years ago2 snippets
Memoize-a-value..js
empty.js

Memoize a value.

2 years ago
Memoize, cache, value or result of a function call.
Memoize-a-value..js
// noinspection ES6ConvertVarToLetConst

/**
 * Cache or memoize data.
 *
 * @example
 *      var vx_cacheador = new ItMemoize();
 *      vx_cacheador.ttlSecondsDefault = 3600; // default is 0 never expire.
 *      function calculateAndMemoize(a, b) {
 *          let k = vx_cacheador.keyMake('calculateAndMemoize', arguments);

empty

2 years ago
Is a variable empty? is_empty
empty.js
/**
 * Determine if v is empty. where empty is: null, false, zero, a blank string, 
 * Object with no keys, Array with 0 length, Set or Map with 0 size
 * Note:  weakMap & weakSet can't be determined if they are empty.
 *
 * @param v
 * @returns {boolean}
 */
function empty(v) {
    if(typeof v === 'undefined' || null === v)