diff options
Diffstat (limited to 'deps/npm/node_modules/cli-table2/node_modules/lodash/utility')
16 files changed, 574 insertions, 0 deletions
diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/attempt.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/attempt.js new file mode 100644 index 0000000000..8d8fb98102 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/attempt.js @@ -0,0 +1,32 @@ +var isError = require('../lang/isError'), + restParam = require('../function/restParam'); + +/** + * Attempts to invoke `func`, returning either the result or the caught error + * object. Any additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @category Utility + * @param {Function} func The function to attempt. + * @returns {*} Returns the `func` result or error object. + * @example + * + * // avoid throwing errors for invalid selectors + * var elements = _.attempt(function(selector) { + * return document.querySelectorAll(selector); + * }, '>_>'); + * + * if (_.isError(elements)) { + * elements = []; + * } + */ +var attempt = restParam(function(func, args) { + try { + return func.apply(undefined, args); + } catch(e) { + return isError(e) ? e : new Error(e); + } +}); + +module.exports = attempt; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/callback.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/callback.js new file mode 100644 index 0000000000..21223d0231 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/callback.js @@ -0,0 +1,53 @@ +var baseCallback = require('../internal/baseCallback'), + isIterateeCall = require('../internal/isIterateeCall'), + isObjectLike = require('../internal/isObjectLike'), + matches = require('./matches'); + +/** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and arguments of the created function. If `func` is a property name the + * created callback returns the property value for a given element. If `func` + * is an object the created callback returns `true` for elements that contain + * the equivalent object properties, otherwise it returns `false`. + * + * @static + * @memberOf _ + * @alias iteratee + * @category Utility + * @param {*} [func=_.identity] The value to convert to a callback. + * @param {*} [thisArg] The `this` binding of `func`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Function} Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // wrap to create custom callback shorthands + * _.callback = _.wrap(_.callback, function(callback, func, thisArg) { + * var match = /^(.+?)__([gl]t)(.+)$/.exec(func); + * if (!match) { + * return callback(func, thisArg); + * } + * return function(object) { + * return match[2] == 'gt' + * ? object[match[1]] > match[3] + * : object[match[1]] < match[3]; + * }; + * }); + * + * _.filter(users, 'age__gt36'); + * // => [{ 'user': 'fred', 'age': 40 }] + */ +function callback(func, thisArg, guard) { + if (guard && isIterateeCall(func, thisArg, guard)) { + thisArg = undefined; + } + return isObjectLike(func) + ? matches(func) + : baseCallback(func, thisArg); +} + +module.exports = callback; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/constant.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/constant.js new file mode 100644 index 0000000000..6919b76328 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/constant.js @@ -0,0 +1,23 @@ +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new function. + * @example + * + * var object = { 'user': 'fred' }; + * var getter = _.constant(object); + * + * getter() === object; + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +module.exports = constant; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/identity.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/identity.js new file mode 100644 index 0000000000..3a1d1d4c9c --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/identity.js @@ -0,0 +1,20 @@ +/** + * This method returns the first argument provided to it. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'user': 'fred' }; + * + * _.identity(object) === object; + * // => true + */ +function identity(value) { + return value; +} + +module.exports = identity; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/iteratee.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/iteratee.js new file mode 100644 index 0000000000..fcfa202105 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/iteratee.js @@ -0,0 +1 @@ +module.exports = require('./callback'); diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/matches.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/matches.js new file mode 100644 index 0000000000..a182637bdb --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/matches.js @@ -0,0 +1,33 @@ +var baseClone = require('../internal/baseClone'), + baseMatches = require('../internal/baseMatches'); + +/** + * Creates a function that performs a deep comparison between a given object + * and `source`, returning `true` if the given object has equivalent property + * values, else `false`. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new function. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, _.matches({ 'age': 40, 'active': false })); + * // => [{ 'user': 'fred', 'age': 40, 'active': false }] + */ +function matches(source) { + return baseMatches(baseClone(source, true)); +} + +module.exports = matches; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/matchesProperty.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/matchesProperty.js new file mode 100644 index 0000000000..91e51a56cb --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/matchesProperty.js @@ -0,0 +1,32 @@ +var baseClone = require('../internal/baseClone'), + baseMatchesProperty = require('../internal/baseMatchesProperty'); + +/** + * Creates a function that compares the property value of `path` on a given + * object to `value`. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new function. + * @example + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * _.find(users, _.matchesProperty('user', 'fred')); + * // => { 'user': 'fred' } + */ +function matchesProperty(path, srcValue) { + return baseMatchesProperty(path, baseClone(srcValue, true)); +} + +module.exports = matchesProperty; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/method.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/method.js new file mode 100644 index 0000000000..e315b7f355 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/method.js @@ -0,0 +1,33 @@ +var invokePath = require('../internal/invokePath'), + restParam = require('../function/restParam'); + +/** + * Creates a function that invokes the method at `path` on a given object. + * Any additional arguments are provided to the invoked method. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Function} Returns the new function. + * @example + * + * var objects = [ + * { 'a': { 'b': { 'c': _.constant(2) } } }, + * { 'a': { 'b': { 'c': _.constant(1) } } } + * ]; + * + * _.map(objects, _.method('a.b.c')); + * // => [2, 1] + * + * _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] + */ +var method = restParam(function(path, args) { + return function(object) { + return invokePath(object, path, args); + }; +}); + +module.exports = method; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/methodOf.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/methodOf.js new file mode 100644 index 0000000000..f61b782272 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/methodOf.js @@ -0,0 +1,32 @@ +var invokePath = require('../internal/invokePath'), + restParam = require('../function/restParam'); + +/** + * The opposite of `_.method`; this method creates a function that invokes + * the method at a given path on `object`. Any additional arguments are + * provided to the invoked method. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} object The object to query. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Function} Returns the new function. + * @example + * + * var array = _.times(3, _.constant), + * object = { 'a': array, 'b': array, 'c': array }; + * + * _.map(['a[2]', 'c[0]'], _.methodOf(object)); + * // => [2, 0] + * + * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); + * // => [2, 0] + */ +var methodOf = restParam(function(object, args) { + return function(path) { + return invokePath(object, path, args); + }; +}); + +module.exports = methodOf; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/mixin.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/mixin.js new file mode 100644 index 0000000000..5c4a372d3c --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/mixin.js @@ -0,0 +1,82 @@ +var arrayCopy = require('../internal/arrayCopy'), + arrayPush = require('../internal/arrayPush'), + baseFunctions = require('../internal/baseFunctions'), + isFunction = require('../lang/isFunction'), + isObject = require('../lang/isObject'), + keys = require('../object/keys'); + +/** + * Adds all own enumerable function properties of a source object to the + * destination object. If `object` is a function then methods are added to + * its prototype as well. + * + * **Note:** Use `_.runInContext` to create a pristine `lodash` function to + * avoid conflicts caused by modifying the original. + * + * @static + * @memberOf _ + * @category Utility + * @param {Function|Object} [object=lodash] The destination object. + * @param {Object} source The object of functions to add. + * @param {Object} [options] The options object. + * @param {boolean} [options.chain=true] Specify whether the functions added + * are chainable. + * @returns {Function|Object} Returns `object`. + * @example + * + * function vowels(string) { + * return _.filter(string, function(v) { + * return /[aeiou]/i.test(v); + * }); + * } + * + * _.mixin({ 'vowels': vowels }); + * _.vowels('fred'); + * // => ['e'] + * + * _('fred').vowels().value(); + * // => ['e'] + * + * _.mixin({ 'vowels': vowels }, { 'chain': false }); + * _('fred').vowels(); + * // => ['e'] + */ +function mixin(object, source, options) { + var methodNames = baseFunctions(source, keys(source)); + + var chain = true, + index = -1, + isFunc = isFunction(object), + length = methodNames.length; + + if (options === false) { + chain = false; + } else if (isObject(options) && 'chain' in options) { + chain = options.chain; + } + while (++index < length) { + var methodName = methodNames[index], + func = source[methodName]; + + object[methodName] = func; + if (isFunc) { + object.prototype[methodName] = (function(func) { + return function() { + var chainAll = this.__chain__; + if (chain || chainAll) { + var result = object(this.__wrapped__), + actions = result.__actions__ = arrayCopy(this.__actions__); + + actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); + result.__chain__ = chainAll; + return result; + } + return func.apply(object, arrayPush([this.value()], arguments)); + }; + }(func)); + } + } + return object; +} + +module.exports = mixin; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/noop.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/noop.js new file mode 100644 index 0000000000..56d651344a --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/noop.js @@ -0,0 +1,19 @@ +/** + * A no-operation function that returns `undefined` regardless of the + * arguments it receives. + * + * @static + * @memberOf _ + * @category Utility + * @example + * + * var object = { 'user': 'fred' }; + * + * _.noop(object) === undefined; + * // => true + */ +function noop() { + // No operation performed. +} + +module.exports = noop; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/property.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/property.js new file mode 100644 index 0000000000..ddfd59798f --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/property.js @@ -0,0 +1,31 @@ +var baseProperty = require('../internal/baseProperty'), + basePropertyDeep = require('../internal/basePropertyDeep'), + isKey = require('../internal/isKey'); + +/** + * Creates a function that returns the property value at `path` on a + * given object. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + * @example + * + * var objects = [ + * { 'a': { 'b': { 'c': 2 } } }, + * { 'a': { 'b': { 'c': 1 } } } + * ]; + * + * _.map(objects, _.property('a.b.c')); + * // => [2, 1] + * + * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] + */ +function property(path) { + return isKey(path) ? baseProperty(path) : basePropertyDeep(path); +} + +module.exports = property; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/propertyOf.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/propertyOf.js new file mode 100644 index 0000000000..593a266b1c --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/propertyOf.js @@ -0,0 +1,30 @@ +var baseGet = require('../internal/baseGet'), + toPath = require('../internal/toPath'); + +/** + * The opposite of `_.property`; this method creates a function that returns + * the property value at a given path on `object`. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} object The object to query. + * @returns {Function} Returns the new function. + * @example + * + * var array = [0, 1, 2], + * object = { 'a': array, 'b': array, 'c': array }; + * + * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); + * // => [2, 0] + * + * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); + * // => [2, 0] + */ +function propertyOf(object) { + return function(path) { + return baseGet(object, toPath(path), (path + '')); + }; +} + +module.exports = propertyOf; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/range.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/range.js new file mode 100644 index 0000000000..671939afcc --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/range.js @@ -0,0 +1,66 @@ +var isIterateeCall = require('../internal/isIterateeCall'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeCeil = Math.ceil, + nativeMax = Math.max; + +/** + * Creates an array of numbers (positive and/or negative) progressing from + * `start` up to, but not including, `end`. If `end` is not specified it's + * set to `start` with `start` then set to `0`. If `end` is less than `start` + * a zero-length range is created unless a negative `step` is specified. + * + * @static + * @memberOf _ + * @category Utility + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @param {number} [step=1] The value to increment or decrement by. + * @returns {Array} Returns the new array of numbers. + * @example + * + * _.range(4); + * // => [0, 1, 2, 3] + * + * _.range(1, 5); + * // => [1, 2, 3, 4] + * + * _.range(0, 20, 5); + * // => [0, 5, 10, 15] + * + * _.range(0, -4, -1); + * // => [0, -1, -2, -3] + * + * _.range(1, 4, 0); + * // => [1, 1, 1] + * + * _.range(0); + * // => [] + */ +function range(start, end, step) { + if (step && isIterateeCall(start, end, step)) { + end = step = undefined; + } + start = +start || 0; + step = step == null ? 1 : (+step || 0); + + if (end == null) { + end = start; + start = 0; + } else { + end = +end || 0; + } + // Use `Array(length)` so engines like Chakra and V8 avoid slower modes. + // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details. + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (++index < length) { + result[index] = start; + start += step; + } + return result; +} + +module.exports = range; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/times.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/times.js new file mode 100644 index 0000000000..9a41e2fe28 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/times.js @@ -0,0 +1,60 @@ +var bindCallback = require('../internal/bindCallback'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeFloor = Math.floor, + nativeIsFinite = global.isFinite, + nativeMin = Math.min; + +/** Used as references for the maximum length and index of an array. */ +var MAX_ARRAY_LENGTH = 4294967295; + +/** + * Invokes the iteratee function `n` times, returning an array of the results + * of each invocation. The `iteratee` is bound to `thisArg` and invoked with + * one argument; (index). + * + * @static + * @memberOf _ + * @category Utility + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the array of results. + * @example + * + * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false)); + * // => [3, 6, 4] + * + * _.times(3, function(n) { + * mage.castSpell(n); + * }); + * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` + * + * _.times(3, function(n) { + * this.cast(n); + * }, mage); + * // => also invokes `mage.castSpell(n)` three times + */ +function times(n, iteratee, thisArg) { + n = nativeFloor(n); + + // Exit early to avoid a JSC JIT bug in Safari 8 + // where `Array(0)` is treated as `Array(1)`. + if (n < 1 || !nativeIsFinite(n)) { + return []; + } + var index = -1, + result = Array(nativeMin(n, MAX_ARRAY_LENGTH)); + + iteratee = bindCallback(iteratee, thisArg, 1); + while (++index < n) { + if (index < MAX_ARRAY_LENGTH) { + result[index] = iteratee(index); + } else { + iteratee(index); + } + } + return result; +} + +module.exports = times; diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/uniqueId.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/uniqueId.js new file mode 100644 index 0000000000..88e02bf300 --- /dev/null +++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/utility/uniqueId.js @@ -0,0 +1,27 @@ +var baseToString = require('../internal/baseToString'); + +/** Used to generate unique IDs. */ +var idCounter = 0; + +/** + * Generates a unique ID. If `prefix` is provided the ID is appended to it. + * + * @static + * @memberOf _ + * @category Utility + * @param {string} [prefix] The value to prefix the ID with. + * @returns {string} Returns the unique ID. + * @example + * + * _.uniqueId('contact_'); + * // => 'contact_104' + * + * _.uniqueId(); + * // => '105' + */ +function uniqueId(prefix) { + var id = ++idCounter; + return baseToString(prefix) + id; +} + +module.exports = uniqueId; |