PageRenderTime 28ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/cordova-plugin-disable-bitcode/node_modules/lodash-node/underscore/index.js

https://gitlab.com/blocknotary/IonicInterviews
JavaScript | 284 lines | 166 code | 17 blank | 101 comment | 4 complexity | a5f9375087e1e6dd554bcd53d811fed5 MD5 | raw file
  1. /**
  2. * @license
  3. * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
  4. * Build: `lodash modularize underscore exports="node" -o ./underscore/`
  5. * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
  6. * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
  7. * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8. * Available under MIT license <http://lodash.com/license>
  9. */
  10. var arrays = require('./arrays'),
  11. chaining = require('./chaining'),
  12. collections = require('./collections'),
  13. functions = require('./functions'),
  14. objects = require('./objects'),
  15. utilities = require('./utilities'),
  16. forEach = require('./collections/forEach'),
  17. forOwn = require('./objects/forOwn'),
  18. lodashWrapper = require('./internals/lodashWrapper'),
  19. mixin = require('./utilities/mixin'),
  20. support = require('./support'),
  21. templateSettings = require('./utilities/templateSettings');
  22. /**
  23. * Used for `Array` method references.
  24. *
  25. * Normally `Array.prototype` would suffice, however, using an array literal
  26. * avoids issues in Narwhal.
  27. */
  28. var arrayRef = [];
  29. /**
  30. * Creates a `lodash` object which wraps the given value to enable intuitive
  31. * method chaining.
  32. *
  33. * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
  34. * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
  35. * and `unshift`
  36. *
  37. * Chaining is supported in custom builds as long as the `value` method is
  38. * implicitly or explicitly included in the build.
  39. *
  40. * The chainable wrapper functions are:
  41. * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
  42. * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,
  43. * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,
  44. * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
  45. * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
  46. * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
  47. * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,
  48. * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
  49. * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,
  50. * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,
  51. * and `zip`
  52. *
  53. * The non-chainable wrapper functions are:
  54. * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,
  55. * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,
  56. * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
  57. * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,
  58. * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,
  59. * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,
  60. * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,
  61. * `template`, `unescape`, `uniqueId`, and `value`
  62. *
  63. * The wrapper functions `first` and `last` return wrapped values when `n` is
  64. * provided, otherwise they return unwrapped values.
  65. *
  66. * Explicit chaining can be enabled by using the `_.chain` method.
  67. *
  68. * @name _
  69. * @constructor
  70. * @category Chaining
  71. * @param {*} value The value to wrap in a `lodash` instance.
  72. * @returns {Object} Returns a `lodash` instance.
  73. * @example
  74. *
  75. * var wrapped = _([1, 2, 3]);
  76. *
  77. * // returns an unwrapped value
  78. * wrapped.reduce(function(sum, num) {
  79. * return sum + num;
  80. * });
  81. * // => 6
  82. *
  83. * // returns a wrapped value
  84. * var squares = wrapped.map(function(num) {
  85. * return num * num;
  86. * });
  87. *
  88. * _.isArray(squares);
  89. * // => false
  90. *
  91. * _.isArray(squares.value());
  92. * // => true
  93. */
  94. function lodash(value) {
  95. return (value instanceof lodash)
  96. ? value
  97. : new lodashWrapper(value);
  98. }
  99. // ensure `new lodashWrapper` is an instance of `lodash`
  100. lodashWrapper.prototype = lodash.prototype;
  101. // wrap `_.mixin` so it works when provided only one argument
  102. mixin = (function(fn) {
  103. return function(object, source) {
  104. if (!source) {
  105. source = object;
  106. object = lodash;
  107. }
  108. return fn(object, source);
  109. };
  110. }(mixin));
  111. // add functions that return wrapped values when chaining
  112. lodash.after = functions.after;
  113. lodash.bind = functions.bind;
  114. lodash.bindAll = functions.bindAll;
  115. lodash.chain = chaining.chain;
  116. lodash.compact = arrays.compact;
  117. lodash.compose = functions.compose;
  118. lodash.countBy = collections.countBy;
  119. lodash.debounce = functions.debounce;
  120. lodash.defaults = objects.defaults;
  121. lodash.defer = functions.defer;
  122. lodash.delay = functions.delay;
  123. lodash.difference = arrays.difference;
  124. lodash.filter = collections.filter;
  125. lodash.flatten = arrays.flatten;
  126. lodash.forEach = forEach;
  127. lodash.functions = objects.functions;
  128. lodash.groupBy = collections.groupBy;
  129. lodash.indexBy = collections.indexBy;
  130. lodash.initial = arrays.initial;
  131. lodash.intersection = arrays.intersection;
  132. lodash.invert = objects.invert;
  133. lodash.invoke = collections.invoke;
  134. lodash.keys = objects.keys;
  135. lodash.map = collections.map;
  136. lodash.max = collections.max;
  137. lodash.memoize = functions.memoize;
  138. lodash.min = collections.min;
  139. lodash.omit = objects.omit;
  140. lodash.once = functions.once;
  141. lodash.pairs = objects.pairs;
  142. lodash.partial = functions.partial;
  143. lodash.pick = objects.pick;
  144. lodash.pluck = collections.pluck;
  145. lodash.range = arrays.range;
  146. lodash.reject = collections.reject;
  147. lodash.rest = arrays.rest;
  148. lodash.shuffle = collections.shuffle;
  149. lodash.sortBy = collections.sortBy;
  150. lodash.tap = chaining.tap;
  151. lodash.throttle = functions.throttle;
  152. lodash.times = utilities.times;
  153. lodash.toArray = collections.toArray;
  154. lodash.union = arrays.union;
  155. lodash.uniq = arrays.uniq;
  156. lodash.values = objects.values;
  157. lodash.where = collections.where;
  158. lodash.without = arrays.without;
  159. lodash.wrap = functions.wrap;
  160. lodash.zip = arrays.zip;
  161. // add aliases
  162. lodash.collect = collections.map;
  163. lodash.drop = arrays.rest;
  164. lodash.each = forEach;
  165. lodash.extend = objects.assign;
  166. lodash.methods = objects.functions;
  167. lodash.object = arrays.zipObject;
  168. lodash.select = collections.filter;
  169. lodash.tail = arrays.rest;
  170. lodash.unique = arrays.uniq;
  171. // add functions that return unwrapped values when chaining
  172. lodash.clone = objects.clone;
  173. lodash.contains = collections.contains;
  174. lodash.escape = utilities.escape;
  175. lodash.every = collections.every;
  176. lodash.find = collections.find;
  177. lodash.has = objects.has;
  178. lodash.identity = utilities.identity;
  179. lodash.indexOf = arrays.indexOf;
  180. lodash.isArguments = objects.isArguments;
  181. lodash.isArray = objects.isArray;
  182. lodash.isBoolean = objects.isBoolean;
  183. lodash.isDate = objects.isDate;
  184. lodash.isElement = objects.isElement;
  185. lodash.isEmpty = objects.isEmpty;
  186. lodash.isEqual = objects.isEqual;
  187. lodash.isFinite = objects.isFinite;
  188. lodash.isFunction = objects.isFunction;
  189. lodash.isNaN = objects.isNaN;
  190. lodash.isNull = objects.isNull;
  191. lodash.isNumber = objects.isNumber;
  192. lodash.isObject = objects.isObject;
  193. lodash.isRegExp = objects.isRegExp;
  194. lodash.isString = objects.isString;
  195. lodash.isUndefined = objects.isUndefined;
  196. lodash.lastIndexOf = arrays.lastIndexOf;
  197. lodash.mixin = mixin;
  198. lodash.noConflict = utilities.noConflict;
  199. lodash.random = utilities.random;
  200. lodash.reduce = collections.reduce;
  201. lodash.reduceRight = collections.reduceRight;
  202. lodash.result = utilities.result;
  203. lodash.size = collections.size;
  204. lodash.some = collections.some;
  205. lodash.sortedIndex = arrays.sortedIndex;
  206. lodash.template = utilities.template;
  207. lodash.unescape = utilities.unescape;
  208. lodash.uniqueId = utilities.uniqueId;
  209. // add aliases
  210. lodash.all = collections.every;
  211. lodash.any = collections.some;
  212. lodash.detect = collections.find;
  213. lodash.findWhere = collections.findWhere;
  214. lodash.foldl = collections.reduce;
  215. lodash.foldr = collections.reduceRight;
  216. lodash.include = collections.contains;
  217. lodash.inject = collections.reduce;
  218. // add functions capable of returning wrapped and unwrapped values when chaining
  219. lodash.first = arrays.first;
  220. lodash.last = arrays.last;
  221. lodash.sample = collections.sample;
  222. // add aliases
  223. lodash.take = arrays.first;
  224. lodash.head = arrays.first;
  225. // add functions to `lodash.prototype`
  226. mixin(lodash);
  227. /**
  228. * The semantic version number.
  229. *
  230. * @static
  231. * @memberOf _
  232. * @type string
  233. */
  234. lodash.VERSION = '2.4.1';
  235. // add "Chaining" functions to the wrapper
  236. lodash.prototype.chain = chaining.wrapperChain;
  237. lodash.prototype.value = chaining.wrapperValueOf;
  238. // add `Array` mutator functions to the wrapper
  239. forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  240. var func = arrayRef[methodName];
  241. lodash.prototype[methodName] = function() {
  242. var value = this.__wrapped__;
  243. func.apply(value, arguments);
  244. // avoid array-like object bugs with `Array#shift` and `Array#splice`
  245. // in Firefox < 10 and IE < 9
  246. if (!support.spliceObjects && value.length === 0) {
  247. delete value[0];
  248. }
  249. return this;
  250. };
  251. });
  252. // add `Array` accessor functions to the wrapper
  253. forEach(['concat', 'join', 'slice'], function(methodName) {
  254. var func = arrayRef[methodName];
  255. lodash.prototype[methodName] = function() {
  256. var value = this.__wrapped__,
  257. result = func.apply(value, arguments);
  258. if (this.__chain__) {
  259. result = new lodashWrapper(result);
  260. result.__chain__ = true;
  261. }
  262. return result;
  263. };
  264. });
  265. lodash.support = support;
  266. (lodash.templateSettings = utilities.templateSettings).imports._ = lodash;
  267. module.exports = lodash;