underscorejs-rb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Readme.md +33 -0
- data/app/assets/javascripts/underscore.js +2022 -0
- data/app/assets/javascripts/underscore.min.js +6 -0
- data/lib/underscorejs-rb/version.rb +5 -0
- data/lib/underscorejs-rb.rb +11 -0
- metadata +75 -0
@@ -0,0 +1,2022 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3
|
+
typeof define === 'function' && define.amd ? define('underscore', factory) :
|
4
|
+
(global = global || self, (function () {
|
5
|
+
var current = global._;
|
6
|
+
var exports = global._ = factory();
|
7
|
+
exports.noConflict = function () { global._ = current; return exports; };
|
8
|
+
}()));
|
9
|
+
}(this, (function () {
|
10
|
+
// Underscore.js 1.12.0
|
11
|
+
// https://underscorejs.org
|
12
|
+
// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
13
|
+
// Underscore may be freely distributed under the MIT license.
|
14
|
+
|
15
|
+
// Current version.
|
16
|
+
var VERSION = '1.12.0';
|
17
|
+
|
18
|
+
// Establish the root object, `window` (`self`) in the browser, `global`
|
19
|
+
// on the server, or `this` in some virtual machines. We use `self`
|
20
|
+
// instead of `window` for `WebWorker` support.
|
21
|
+
var root = typeof self == 'object' && self.self === self && self ||
|
22
|
+
typeof global == 'object' && global.global === global && global ||
|
23
|
+
Function('return this')() ||
|
24
|
+
{};
|
25
|
+
|
26
|
+
// Save bytes in the minified (but not gzipped) version:
|
27
|
+
var ArrayProto = Array.prototype, ObjProto = Object.prototype;
|
28
|
+
var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
|
29
|
+
|
30
|
+
// Create quick reference variables for speed access to core prototypes.
|
31
|
+
var push = ArrayProto.push,
|
32
|
+
slice = ArrayProto.slice,
|
33
|
+
toString = ObjProto.toString,
|
34
|
+
hasOwnProperty = ObjProto.hasOwnProperty;
|
35
|
+
|
36
|
+
// Modern feature detection.
|
37
|
+
var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
|
38
|
+
supportsDataView = typeof DataView !== 'undefined';
|
39
|
+
|
40
|
+
// All **ECMAScript 5+** native function implementations that we hope to use
|
41
|
+
// are declared here.
|
42
|
+
var nativeIsArray = Array.isArray,
|
43
|
+
nativeKeys = Object.keys,
|
44
|
+
nativeCreate = Object.create,
|
45
|
+
nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
|
46
|
+
|
47
|
+
// Create references to these builtin functions because we override them.
|
48
|
+
var _isNaN = isNaN,
|
49
|
+
_isFinite = isFinite;
|
50
|
+
|
51
|
+
// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
|
52
|
+
var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
|
53
|
+
var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
|
54
|
+
'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
|
55
|
+
|
56
|
+
// The largest integer that can be represented exactly.
|
57
|
+
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
|
58
|
+
|
59
|
+
// Some functions take a variable number of arguments, or a few expected
|
60
|
+
// arguments at the beginning and then a variable number of values to operate
|
61
|
+
// on. This helper accumulates all remaining arguments past the function’s
|
62
|
+
// argument length (or an explicit `startIndex`), into an array that becomes
|
63
|
+
// the last argument. Similar to ES6’s "rest parameter".
|
64
|
+
function restArguments(func, startIndex) {
|
65
|
+
startIndex = startIndex == null ? func.length - 1 : +startIndex;
|
66
|
+
return function() {
|
67
|
+
var length = Math.max(arguments.length - startIndex, 0),
|
68
|
+
rest = Array(length),
|
69
|
+
index = 0;
|
70
|
+
for (; index < length; index++) {
|
71
|
+
rest[index] = arguments[index + startIndex];
|
72
|
+
}
|
73
|
+
switch (startIndex) {
|
74
|
+
case 0: return func.call(this, rest);
|
75
|
+
case 1: return func.call(this, arguments[0], rest);
|
76
|
+
case 2: return func.call(this, arguments[0], arguments[1], rest);
|
77
|
+
}
|
78
|
+
var args = Array(startIndex + 1);
|
79
|
+
for (index = 0; index < startIndex; index++) {
|
80
|
+
args[index] = arguments[index];
|
81
|
+
}
|
82
|
+
args[startIndex] = rest;
|
83
|
+
return func.apply(this, args);
|
84
|
+
};
|
85
|
+
}
|
86
|
+
|
87
|
+
// Is a given variable an object?
|
88
|
+
function isObject(obj) {
|
89
|
+
var type = typeof obj;
|
90
|
+
return type === 'function' || type === 'object' && !!obj;
|
91
|
+
}
|
92
|
+
|
93
|
+
// Is a given value equal to null?
|
94
|
+
function isNull(obj) {
|
95
|
+
return obj === null;
|
96
|
+
}
|
97
|
+
|
98
|
+
// Is a given variable undefined?
|
99
|
+
function isUndefined(obj) {
|
100
|
+
return obj === void 0;
|
101
|
+
}
|
102
|
+
|
103
|
+
// Is a given value a boolean?
|
104
|
+
function isBoolean(obj) {
|
105
|
+
return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
|
106
|
+
}
|
107
|
+
|
108
|
+
// Is a given value a DOM element?
|
109
|
+
function isElement(obj) {
|
110
|
+
return !!(obj && obj.nodeType === 1);
|
111
|
+
}
|
112
|
+
|
113
|
+
// Internal function for creating a `toString`-based type tester.
|
114
|
+
function tagTester(name) {
|
115
|
+
var tag = '[object ' + name + ']';
|
116
|
+
return function(obj) {
|
117
|
+
return toString.call(obj) === tag;
|
118
|
+
};
|
119
|
+
}
|
120
|
+
|
121
|
+
var isString = tagTester('String');
|
122
|
+
|
123
|
+
var isNumber = tagTester('Number');
|
124
|
+
|
125
|
+
var isDate = tagTester('Date');
|
126
|
+
|
127
|
+
var isRegExp = tagTester('RegExp');
|
128
|
+
|
129
|
+
var isError = tagTester('Error');
|
130
|
+
|
131
|
+
var isSymbol = tagTester('Symbol');
|
132
|
+
|
133
|
+
var isArrayBuffer = tagTester('ArrayBuffer');
|
134
|
+
|
135
|
+
var isFunction = tagTester('Function');
|
136
|
+
|
137
|
+
// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
|
138
|
+
// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
|
139
|
+
var nodelist = root.document && root.document.childNodes;
|
140
|
+
if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
|
141
|
+
isFunction = function(obj) {
|
142
|
+
return typeof obj == 'function' || false;
|
143
|
+
};
|
144
|
+
}
|
145
|
+
|
146
|
+
var isFunction$1 = isFunction;
|
147
|
+
|
148
|
+
var hasObjectTag = tagTester('Object');
|
149
|
+
|
150
|
+
// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
|
151
|
+
// In IE 11, the most common among them, this problem also applies to
|
152
|
+
// `Map`, `WeakMap` and `Set`.
|
153
|
+
var hasStringTagBug = (
|
154
|
+
supportsDataView && hasObjectTag(new DataView(new ArrayBuffer(8)))
|
155
|
+
),
|
156
|
+
isIE11 = (typeof Map !== 'undefined' && hasObjectTag(new Map));
|
157
|
+
|
158
|
+
var isDataView = tagTester('DataView');
|
159
|
+
|
160
|
+
// In IE 10 - Edge 13, we need a different heuristic
|
161
|
+
// to determine whether an object is a `DataView`.
|
162
|
+
function ie10IsDataView(obj) {
|
163
|
+
return obj != null && isFunction$1(obj.getInt8) && isArrayBuffer(obj.buffer);
|
164
|
+
}
|
165
|
+
|
166
|
+
var isDataView$1 = (hasStringTagBug ? ie10IsDataView : isDataView);
|
167
|
+
|
168
|
+
// Is a given value an array?
|
169
|
+
// Delegates to ECMA5's native `Array.isArray`.
|
170
|
+
var isArray = nativeIsArray || tagTester('Array');
|
171
|
+
|
172
|
+
// Internal function to check whether `key` is an own property name of `obj`.
|
173
|
+
function has(obj, key) {
|
174
|
+
return obj != null && hasOwnProperty.call(obj, key);
|
175
|
+
}
|
176
|
+
|
177
|
+
var isArguments = tagTester('Arguments');
|
178
|
+
|
179
|
+
// Define a fallback version of the method in browsers (ahem, IE < 9), where
|
180
|
+
// there isn't any inspectable "Arguments" type.
|
181
|
+
(function() {
|
182
|
+
if (!isArguments(arguments)) {
|
183
|
+
isArguments = function(obj) {
|
184
|
+
return has(obj, 'callee');
|
185
|
+
};
|
186
|
+
}
|
187
|
+
}());
|
188
|
+
|
189
|
+
var isArguments$1 = isArguments;
|
190
|
+
|
191
|
+
// Is a given object a finite number?
|
192
|
+
function isFinite$1(obj) {
|
193
|
+
return !isSymbol(obj) && _isFinite(obj) && !isNaN(parseFloat(obj));
|
194
|
+
}
|
195
|
+
|
196
|
+
// Is the given value `NaN`?
|
197
|
+
function isNaN$1(obj) {
|
198
|
+
return isNumber(obj) && _isNaN(obj);
|
199
|
+
}
|
200
|
+
|
201
|
+
// Predicate-generating function. Often useful outside of Underscore.
|
202
|
+
function constant(value) {
|
203
|
+
return function() {
|
204
|
+
return value;
|
205
|
+
};
|
206
|
+
}
|
207
|
+
|
208
|
+
// Common internal logic for `isArrayLike` and `isBufferLike`.
|
209
|
+
function createSizePropertyCheck(getSizeProperty) {
|
210
|
+
return function(collection) {
|
211
|
+
var sizeProperty = getSizeProperty(collection);
|
212
|
+
return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= MAX_ARRAY_INDEX;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
// Internal helper to generate a function to obtain property `key` from `obj`.
|
217
|
+
function shallowProperty(key) {
|
218
|
+
return function(obj) {
|
219
|
+
return obj == null ? void 0 : obj[key];
|
220
|
+
};
|
221
|
+
}
|
222
|
+
|
223
|
+
// Internal helper to obtain the `byteLength` property of an object.
|
224
|
+
var getByteLength = shallowProperty('byteLength');
|
225
|
+
|
226
|
+
// Internal helper to determine whether we should spend extensive checks against
|
227
|
+
// `ArrayBuffer` et al.
|
228
|
+
var isBufferLike = createSizePropertyCheck(getByteLength);
|
229
|
+
|
230
|
+
// Is a given value a typed array?
|
231
|
+
var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
|
232
|
+
function isTypedArray(obj) {
|
233
|
+
// `ArrayBuffer.isView` is the most future-proof, so use it when available.
|
234
|
+
// Otherwise, fall back on the above regular expression.
|
235
|
+
return nativeIsView ? (nativeIsView(obj) && !isDataView$1(obj)) :
|
236
|
+
isBufferLike(obj) && typedArrayPattern.test(toString.call(obj));
|
237
|
+
}
|
238
|
+
|
239
|
+
var isTypedArray$1 = supportsArrayBuffer ? isTypedArray : constant(false);
|
240
|
+
|
241
|
+
// Internal helper to obtain the `length` property of an object.
|
242
|
+
var getLength = shallowProperty('length');
|
243
|
+
|
244
|
+
// Internal helper to create a simple lookup structure.
|
245
|
+
// `collectNonEnumProps` used to depend on `_.contains`, but this led to
|
246
|
+
// circular imports. `emulatedSet` is a one-off solution that only works for
|
247
|
+
// arrays of strings.
|
248
|
+
function emulatedSet(keys) {
|
249
|
+
var hash = {};
|
250
|
+
for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
|
251
|
+
return {
|
252
|
+
contains: function(key) { return hash[key]; },
|
253
|
+
push: function(key) {
|
254
|
+
hash[key] = true;
|
255
|
+
return keys.push(key);
|
256
|
+
}
|
257
|
+
};
|
258
|
+
}
|
259
|
+
|
260
|
+
// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
|
261
|
+
// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
|
262
|
+
// needed.
|
263
|
+
function collectNonEnumProps(obj, keys) {
|
264
|
+
keys = emulatedSet(keys);
|
265
|
+
var nonEnumIdx = nonEnumerableProps.length;
|
266
|
+
var constructor = obj.constructor;
|
267
|
+
var proto = isFunction$1(constructor) && constructor.prototype || ObjProto;
|
268
|
+
|
269
|
+
// Constructor is a special case.
|
270
|
+
var prop = 'constructor';
|
271
|
+
if (has(obj, prop) && !keys.contains(prop)) keys.push(prop);
|
272
|
+
|
273
|
+
while (nonEnumIdx--) {
|
274
|
+
prop = nonEnumerableProps[nonEnumIdx];
|
275
|
+
if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
|
276
|
+
keys.push(prop);
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
// Retrieve the names of an object's own properties.
|
282
|
+
// Delegates to **ECMAScript 5**'s native `Object.keys`.
|
283
|
+
function keys(obj) {
|
284
|
+
if (!isObject(obj)) return [];
|
285
|
+
if (nativeKeys) return nativeKeys(obj);
|
286
|
+
var keys = [];
|
287
|
+
for (var key in obj) if (has(obj, key)) keys.push(key);
|
288
|
+
// Ahem, IE < 9.
|
289
|
+
if (hasEnumBug) collectNonEnumProps(obj, keys);
|
290
|
+
return keys;
|
291
|
+
}
|
292
|
+
|
293
|
+
// Is a given array, string, or object empty?
|
294
|
+
// An "empty" object has no enumerable own-properties.
|
295
|
+
function isEmpty(obj) {
|
296
|
+
if (obj == null) return true;
|
297
|
+
// Skip the more expensive `toString`-based type checks if `obj` has no
|
298
|
+
// `.length`.
|
299
|
+
var length = getLength(obj);
|
300
|
+
if (typeof length == 'number' && (
|
301
|
+
isArray(obj) || isString(obj) || isArguments$1(obj)
|
302
|
+
)) return length === 0;
|
303
|
+
return getLength(keys(obj)) === 0;
|
304
|
+
}
|
305
|
+
|
306
|
+
// Returns whether an object has a given set of `key:value` pairs.
|
307
|
+
function isMatch(object, attrs) {
|
308
|
+
var _keys = keys(attrs), length = _keys.length;
|
309
|
+
if (object == null) return !length;
|
310
|
+
var obj = Object(object);
|
311
|
+
for (var i = 0; i < length; i++) {
|
312
|
+
var key = _keys[i];
|
313
|
+
if (attrs[key] !== obj[key] || !(key in obj)) return false;
|
314
|
+
}
|
315
|
+
return true;
|
316
|
+
}
|
317
|
+
|
318
|
+
// If Underscore is called as a function, it returns a wrapped object that can
|
319
|
+
// be used OO-style. This wrapper holds altered versions of all functions added
|
320
|
+
// through `_.mixin`. Wrapped objects may be chained.
|
321
|
+
function _(obj) {
|
322
|
+
if (obj instanceof _) return obj;
|
323
|
+
if (!(this instanceof _)) return new _(obj);
|
324
|
+
this._wrapped = obj;
|
325
|
+
}
|
326
|
+
|
327
|
+
_.VERSION = VERSION;
|
328
|
+
|
329
|
+
// Extracts the result from a wrapped and chained object.
|
330
|
+
_.prototype.value = function() {
|
331
|
+
return this._wrapped;
|
332
|
+
};
|
333
|
+
|
334
|
+
// Provide unwrapping proxies for some methods used in engine operations
|
335
|
+
// such as arithmetic and JSON stringification.
|
336
|
+
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
|
337
|
+
|
338
|
+
_.prototype.toString = function() {
|
339
|
+
return String(this._wrapped);
|
340
|
+
};
|
341
|
+
|
342
|
+
// Internal function to wrap or shallow-copy an ArrayBuffer,
|
343
|
+
// typed array or DataView to a new view, reusing the buffer.
|
344
|
+
function toBufferView(bufferSource) {
|
345
|
+
return new Uint8Array(
|
346
|
+
bufferSource.buffer || bufferSource,
|
347
|
+
bufferSource.byteOffset || 0,
|
348
|
+
getByteLength(bufferSource)
|
349
|
+
);
|
350
|
+
}
|
351
|
+
|
352
|
+
// We use this string twice, so give it a name for minification.
|
353
|
+
var tagDataView = '[object DataView]';
|
354
|
+
|
355
|
+
// Internal recursive comparison function for `_.isEqual`.
|
356
|
+
function eq(a, b, aStack, bStack) {
|
357
|
+
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
358
|
+
// See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
359
|
+
if (a === b) return a !== 0 || 1 / a === 1 / b;
|
360
|
+
// `null` or `undefined` only equal to itself (strict comparison).
|
361
|
+
if (a == null || b == null) return false;
|
362
|
+
// `NaN`s are equivalent, but non-reflexive.
|
363
|
+
if (a !== a) return b !== b;
|
364
|
+
// Exhaust primitive checks
|
365
|
+
var type = typeof a;
|
366
|
+
if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
|
367
|
+
return deepEq(a, b, aStack, bStack);
|
368
|
+
}
|
369
|
+
|
370
|
+
// Internal recursive comparison function for `_.isEqual`.
|
371
|
+
function deepEq(a, b, aStack, bStack) {
|
372
|
+
// Unwrap any wrapped objects.
|
373
|
+
if (a instanceof _) a = a._wrapped;
|
374
|
+
if (b instanceof _) b = b._wrapped;
|
375
|
+
// Compare `[[Class]]` names.
|
376
|
+
var className = toString.call(a);
|
377
|
+
if (className !== toString.call(b)) return false;
|
378
|
+
// Work around a bug in IE 10 - Edge 13.
|
379
|
+
if (hasStringTagBug && className == '[object Object]' && isDataView$1(a)) {
|
380
|
+
if (!isDataView$1(b)) return false;
|
381
|
+
className = tagDataView;
|
382
|
+
}
|
383
|
+
switch (className) {
|
384
|
+
// These types are compared by value.
|
385
|
+
case '[object RegExp]':
|
386
|
+
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
|
387
|
+
case '[object String]':
|
388
|
+
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
|
389
|
+
// equivalent to `new String("5")`.
|
390
|
+
return '' + a === '' + b;
|
391
|
+
case '[object Number]':
|
392
|
+
// `NaN`s are equivalent, but non-reflexive.
|
393
|
+
// Object(NaN) is equivalent to NaN.
|
394
|
+
if (+a !== +a) return +b !== +b;
|
395
|
+
// An `egal` comparison is performed for other numeric values.
|
396
|
+
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
|
397
|
+
case '[object Date]':
|
398
|
+
case '[object Boolean]':
|
399
|
+
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
|
400
|
+
// millisecond representations. Note that invalid dates with millisecond representations
|
401
|
+
// of `NaN` are not equivalent.
|
402
|
+
return +a === +b;
|
403
|
+
case '[object Symbol]':
|
404
|
+
return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);
|
405
|
+
case '[object ArrayBuffer]':
|
406
|
+
case tagDataView:
|
407
|
+
// Coerce to typed array so we can fall through.
|
408
|
+
return deepEq(toBufferView(a), toBufferView(b), aStack, bStack);
|
409
|
+
}
|
410
|
+
|
411
|
+
var areArrays = className === '[object Array]';
|
412
|
+
if (!areArrays && isTypedArray$1(a)) {
|
413
|
+
var byteLength = getByteLength(a);
|
414
|
+
if (byteLength !== getByteLength(b)) return false;
|
415
|
+
if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
|
416
|
+
areArrays = true;
|
417
|
+
}
|
418
|
+
if (!areArrays) {
|
419
|
+
if (typeof a != 'object' || typeof b != 'object') return false;
|
420
|
+
|
421
|
+
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
|
422
|
+
// from different frames are.
|
423
|
+
var aCtor = a.constructor, bCtor = b.constructor;
|
424
|
+
if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor &&
|
425
|
+
isFunction$1(bCtor) && bCtor instanceof bCtor)
|
426
|
+
&& ('constructor' in a && 'constructor' in b)) {
|
427
|
+
return false;
|
428
|
+
}
|
429
|
+
}
|
430
|
+
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
431
|
+
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
432
|
+
|
433
|
+
// Initializing stack of traversed objects.
|
434
|
+
// It's done here since we only need them for objects and arrays comparison.
|
435
|
+
aStack = aStack || [];
|
436
|
+
bStack = bStack || [];
|
437
|
+
var length = aStack.length;
|
438
|
+
while (length--) {
|
439
|
+
// Linear search. Performance is inversely proportional to the number of
|
440
|
+
// unique nested structures.
|
441
|
+
if (aStack[length] === a) return bStack[length] === b;
|
442
|
+
}
|
443
|
+
|
444
|
+
// Add the first object to the stack of traversed objects.
|
445
|
+
aStack.push(a);
|
446
|
+
bStack.push(b);
|
447
|
+
|
448
|
+
// Recursively compare objects and arrays.
|
449
|
+
if (areArrays) {
|
450
|
+
// Compare array lengths to determine if a deep comparison is necessary.
|
451
|
+
length = a.length;
|
452
|
+
if (length !== b.length) return false;
|
453
|
+
// Deep compare the contents, ignoring non-numeric properties.
|
454
|
+
while (length--) {
|
455
|
+
if (!eq(a[length], b[length], aStack, bStack)) return false;
|
456
|
+
}
|
457
|
+
} else {
|
458
|
+
// Deep compare objects.
|
459
|
+
var _keys = keys(a), key;
|
460
|
+
length = _keys.length;
|
461
|
+
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
462
|
+
if (keys(b).length !== length) return false;
|
463
|
+
while (length--) {
|
464
|
+
// Deep compare each member
|
465
|
+
key = _keys[length];
|
466
|
+
if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
|
467
|
+
}
|
468
|
+
}
|
469
|
+
// Remove the first object from the stack of traversed objects.
|
470
|
+
aStack.pop();
|
471
|
+
bStack.pop();
|
472
|
+
return true;
|
473
|
+
}
|
474
|
+
|
475
|
+
// Perform a deep comparison to check if two objects are equal.
|
476
|
+
function isEqual(a, b) {
|
477
|
+
return eq(a, b);
|
478
|
+
}
|
479
|
+
|
480
|
+
// Retrieve all the enumerable property names of an object.
|
481
|
+
function allKeys(obj) {
|
482
|
+
if (!isObject(obj)) return [];
|
483
|
+
var keys = [];
|
484
|
+
for (var key in obj) keys.push(key);
|
485
|
+
// Ahem, IE < 9.
|
486
|
+
if (hasEnumBug) collectNonEnumProps(obj, keys);
|
487
|
+
return keys;
|
488
|
+
}
|
489
|
+
|
490
|
+
// Since the regular `Object.prototype.toString` type tests don't work for
|
491
|
+
// some types in IE 11, we use a fingerprinting heuristic instead, based
|
492
|
+
// on the methods. It's not great, but it's the best we got.
|
493
|
+
// The fingerprint method lists are defined below.
|
494
|
+
function ie11fingerprint(methods) {
|
495
|
+
var length = getLength(methods);
|
496
|
+
return function(obj) {
|
497
|
+
if (obj == null) return false;
|
498
|
+
// `Map`, `WeakMap` and `Set` have no enumerable keys.
|
499
|
+
var keys = allKeys(obj);
|
500
|
+
if (getLength(keys)) return false;
|
501
|
+
for (var i = 0; i < length; i++) {
|
502
|
+
if (!isFunction$1(obj[methods[i]])) return false;
|
503
|
+
}
|
504
|
+
// If we are testing against `WeakMap`, we need to ensure that
|
505
|
+
// `obj` doesn't have a `forEach` method in order to distinguish
|
506
|
+
// it from a regular `Map`.
|
507
|
+
return methods !== weakMapMethods || !isFunction$1(obj[forEachName]);
|
508
|
+
};
|
509
|
+
}
|
510
|
+
|
511
|
+
// In the interest of compact minification, we write
|
512
|
+
// each string in the fingerprints only once.
|
513
|
+
var forEachName = 'forEach',
|
514
|
+
hasName = 'has',
|
515
|
+
commonInit = ['clear', 'delete'],
|
516
|
+
mapTail = ['get', hasName, 'set'];
|
517
|
+
|
518
|
+
// `Map`, `WeakMap` and `Set` each have slightly different
|
519
|
+
// combinations of the above sublists.
|
520
|
+
var mapMethods = commonInit.concat(forEachName, mapTail),
|
521
|
+
weakMapMethods = commonInit.concat(mapTail),
|
522
|
+
setMethods = ['add'].concat(commonInit, forEachName, hasName);
|
523
|
+
|
524
|
+
var isMap = isIE11 ? ie11fingerprint(mapMethods) : tagTester('Map');
|
525
|
+
|
526
|
+
var isWeakMap = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap');
|
527
|
+
|
528
|
+
var isSet = isIE11 ? ie11fingerprint(setMethods) : tagTester('Set');
|
529
|
+
|
530
|
+
var isWeakSet = tagTester('WeakSet');
|
531
|
+
|
532
|
+
// Retrieve the values of an object's properties.
|
533
|
+
function values(obj) {
|
534
|
+
var _keys = keys(obj);
|
535
|
+
var length = _keys.length;
|
536
|
+
var values = Array(length);
|
537
|
+
for (var i = 0; i < length; i++) {
|
538
|
+
values[i] = obj[_keys[i]];
|
539
|
+
}
|
540
|
+
return values;
|
541
|
+
}
|
542
|
+
|
543
|
+
// Convert an object into a list of `[key, value]` pairs.
|
544
|
+
// The opposite of `_.object` with one argument.
|
545
|
+
function pairs(obj) {
|
546
|
+
var _keys = keys(obj);
|
547
|
+
var length = _keys.length;
|
548
|
+
var pairs = Array(length);
|
549
|
+
for (var i = 0; i < length; i++) {
|
550
|
+
pairs[i] = [_keys[i], obj[_keys[i]]];
|
551
|
+
}
|
552
|
+
return pairs;
|
553
|
+
}
|
554
|
+
|
555
|
+
// Invert the keys and values of an object. The values must be serializable.
|
556
|
+
function invert(obj) {
|
557
|
+
var result = {};
|
558
|
+
var _keys = keys(obj);
|
559
|
+
for (var i = 0, length = _keys.length; i < length; i++) {
|
560
|
+
result[obj[_keys[i]]] = _keys[i];
|
561
|
+
}
|
562
|
+
return result;
|
563
|
+
}
|
564
|
+
|
565
|
+
// Return a sorted list of the function names available on the object.
|
566
|
+
function functions(obj) {
|
567
|
+
var names = [];
|
568
|
+
for (var key in obj) {
|
569
|
+
if (isFunction$1(obj[key])) names.push(key);
|
570
|
+
}
|
571
|
+
return names.sort();
|
572
|
+
}
|
573
|
+
|
574
|
+
// An internal function for creating assigner functions.
|
575
|
+
function createAssigner(keysFunc, defaults) {
|
576
|
+
return function(obj) {
|
577
|
+
var length = arguments.length;
|
578
|
+
if (defaults) obj = Object(obj);
|
579
|
+
if (length < 2 || obj == null) return obj;
|
580
|
+
for (var index = 1; index < length; index++) {
|
581
|
+
var source = arguments[index],
|
582
|
+
keys = keysFunc(source),
|
583
|
+
l = keys.length;
|
584
|
+
for (var i = 0; i < l; i++) {
|
585
|
+
var key = keys[i];
|
586
|
+
if (!defaults || obj[key] === void 0) obj[key] = source[key];
|
587
|
+
}
|
588
|
+
}
|
589
|
+
return obj;
|
590
|
+
};
|
591
|
+
}
|
592
|
+
|
593
|
+
// Extend a given object with all the properties in passed-in object(s).
|
594
|
+
var extend = createAssigner(allKeys);
|
595
|
+
|
596
|
+
// Assigns a given object with all the own properties in the passed-in
|
597
|
+
// object(s).
|
598
|
+
// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
|
599
|
+
var extendOwn = createAssigner(keys);
|
600
|
+
|
601
|
+
// Fill in a given object with default properties.
|
602
|
+
var defaults = createAssigner(allKeys, true);
|
603
|
+
|
604
|
+
// Create a naked function reference for surrogate-prototype-swapping.
|
605
|
+
function ctor() {
|
606
|
+
return function(){};
|
607
|
+
}
|
608
|
+
|
609
|
+
// An internal function for creating a new object that inherits from another.
|
610
|
+
function baseCreate(prototype) {
|
611
|
+
if (!isObject(prototype)) return {};
|
612
|
+
if (nativeCreate) return nativeCreate(prototype);
|
613
|
+
var Ctor = ctor();
|
614
|
+
Ctor.prototype = prototype;
|
615
|
+
var result = new Ctor;
|
616
|
+
Ctor.prototype = null;
|
617
|
+
return result;
|
618
|
+
}
|
619
|
+
|
620
|
+
// Creates an object that inherits from the given prototype object.
|
621
|
+
// If additional properties are provided then they will be added to the
|
622
|
+
// created object.
|
623
|
+
function create(prototype, props) {
|
624
|
+
var result = baseCreate(prototype);
|
625
|
+
if (props) extendOwn(result, props);
|
626
|
+
return result;
|
627
|
+
}
|
628
|
+
|
629
|
+
// Create a (shallow-cloned) duplicate of an object.
|
630
|
+
function clone(obj) {
|
631
|
+
if (!isObject(obj)) return obj;
|
632
|
+
return isArray(obj) ? obj.slice() : extend({}, obj);
|
633
|
+
}
|
634
|
+
|
635
|
+
// Invokes `interceptor` with the `obj` and then returns `obj`.
|
636
|
+
// The primary purpose of this method is to "tap into" a method chain, in
|
637
|
+
// order to perform operations on intermediate results within the chain.
|
638
|
+
function tap(obj, interceptor) {
|
639
|
+
interceptor(obj);
|
640
|
+
return obj;
|
641
|
+
}
|
642
|
+
|
643
|
+
// Normalize a (deep) property `path` to array.
|
644
|
+
// Like `_.iteratee`, this function can be customized.
|
645
|
+
function toPath(path) {
|
646
|
+
return isArray(path) ? path : [path];
|
647
|
+
}
|
648
|
+
_.toPath = toPath;
|
649
|
+
|
650
|
+
// Internal wrapper for `_.toPath` to enable minification.
|
651
|
+
// Similar to `cb` for `_.iteratee`.
|
652
|
+
function toPath$1(path) {
|
653
|
+
return _.toPath(path);
|
654
|
+
}
|
655
|
+
|
656
|
+
// Internal function to obtain a nested property in `obj` along `path`.
|
657
|
+
function deepGet(obj, path) {
|
658
|
+
var length = path.length;
|
659
|
+
for (var i = 0; i < length; i++) {
|
660
|
+
if (obj == null) return void 0;
|
661
|
+
obj = obj[path[i]];
|
662
|
+
}
|
663
|
+
return length ? obj : void 0;
|
664
|
+
}
|
665
|
+
|
666
|
+
// Get the value of the (deep) property on `path` from `object`.
|
667
|
+
// If any property in `path` does not exist or if the value is
|
668
|
+
// `undefined`, return `defaultValue` instead.
|
669
|
+
// The `path` is normalized through `_.toPath`.
|
670
|
+
function get(object, path, defaultValue) {
|
671
|
+
var value = deepGet(object, toPath$1(path));
|
672
|
+
return isUndefined(value) ? defaultValue : value;
|
673
|
+
}
|
674
|
+
|
675
|
+
// Shortcut function for checking if an object has a given property directly on
|
676
|
+
// itself (in other words, not on a prototype). Unlike the internal `has`
|
677
|
+
// function, this public version can also traverse nested properties.
|
678
|
+
function has$1(obj, path) {
|
679
|
+
path = toPath$1(path);
|
680
|
+
var length = path.length;
|
681
|
+
for (var i = 0; i < length; i++) {
|
682
|
+
var key = path[i];
|
683
|
+
if (!has(obj, key)) return false;
|
684
|
+
obj = obj[key];
|
685
|
+
}
|
686
|
+
return !!length;
|
687
|
+
}
|
688
|
+
|
689
|
+
// Keep the identity function around for default iteratees.
|
690
|
+
function identity(value) {
|
691
|
+
return value;
|
692
|
+
}
|
693
|
+
|
694
|
+
// Returns a predicate for checking whether an object has a given set of
|
695
|
+
// `key:value` pairs.
|
696
|
+
function matcher(attrs) {
|
697
|
+
attrs = extendOwn({}, attrs);
|
698
|
+
return function(obj) {
|
699
|
+
return isMatch(obj, attrs);
|
700
|
+
};
|
701
|
+
}
|
702
|
+
|
703
|
+
// Creates a function that, when passed an object, will traverse that object’s
|
704
|
+
// properties down the given `path`, specified as an array of keys or indices.
|
705
|
+
function property(path) {
|
706
|
+
path = toPath$1(path);
|
707
|
+
return function(obj) {
|
708
|
+
return deepGet(obj, path);
|
709
|
+
};
|
710
|
+
}
|
711
|
+
|
712
|
+
// Internal function that returns an efficient (for current engines) version
|
713
|
+
// of the passed-in callback, to be repeatedly applied in other Underscore
|
714
|
+
// functions.
|
715
|
+
function optimizeCb(func, context, argCount) {
|
716
|
+
if (context === void 0) return func;
|
717
|
+
switch (argCount == null ? 3 : argCount) {
|
718
|
+
case 1: return function(value) {
|
719
|
+
return func.call(context, value);
|
720
|
+
};
|
721
|
+
// The 2-argument case is omitted because we’re not using it.
|
722
|
+
case 3: return function(value, index, collection) {
|
723
|
+
return func.call(context, value, index, collection);
|
724
|
+
};
|
725
|
+
case 4: return function(accumulator, value, index, collection) {
|
726
|
+
return func.call(context, accumulator, value, index, collection);
|
727
|
+
};
|
728
|
+
}
|
729
|
+
return function() {
|
730
|
+
return func.apply(context, arguments);
|
731
|
+
};
|
732
|
+
}
|
733
|
+
|
734
|
+
// An internal function to generate callbacks that can be applied to each
|
735
|
+
// element in a collection, returning the desired result — either `_.identity`,
|
736
|
+
// an arbitrary callback, a property matcher, or a property accessor.
|
737
|
+
function baseIteratee(value, context, argCount) {
|
738
|
+
if (value == null) return identity;
|
739
|
+
if (isFunction$1(value)) return optimizeCb(value, context, argCount);
|
740
|
+
if (isObject(value) && !isArray(value)) return matcher(value);
|
741
|
+
return property(value);
|
742
|
+
}
|
743
|
+
|
744
|
+
// External wrapper for our callback generator. Users may customize
|
745
|
+
// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
|
746
|
+
// This abstraction hides the internal-only `argCount` argument.
|
747
|
+
function iteratee(value, context) {
|
748
|
+
return baseIteratee(value, context, Infinity);
|
749
|
+
}
|
750
|
+
_.iteratee = iteratee;
|
751
|
+
|
752
|
+
// The function we call internally to generate a callback. It invokes
|
753
|
+
// `_.iteratee` if overridden, otherwise `baseIteratee`.
|
754
|
+
function cb(value, context, argCount) {
|
755
|
+
if (_.iteratee !== iteratee) return _.iteratee(value, context);
|
756
|
+
return baseIteratee(value, context, argCount);
|
757
|
+
}
|
758
|
+
|
759
|
+
// Returns the results of applying the `iteratee` to each element of `obj`.
|
760
|
+
// In contrast to `_.map` it returns an object.
|
761
|
+
function mapObject(obj, iteratee, context) {
|
762
|
+
iteratee = cb(iteratee, context);
|
763
|
+
var _keys = keys(obj),
|
764
|
+
length = _keys.length,
|
765
|
+
results = {};
|
766
|
+
for (var index = 0; index < length; index++) {
|
767
|
+
var currentKey = _keys[index];
|
768
|
+
results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
|
769
|
+
}
|
770
|
+
return results;
|
771
|
+
}
|
772
|
+
|
773
|
+
// Predicate-generating function. Often useful outside of Underscore.
|
774
|
+
function noop(){}
|
775
|
+
|
776
|
+
// Generates a function for a given object that returns a given property.
|
777
|
+
function propertyOf(obj) {
|
778
|
+
if (obj == null) return noop;
|
779
|
+
return function(path) {
|
780
|
+
return get(obj, path);
|
781
|
+
};
|
782
|
+
}
|
783
|
+
|
784
|
+
// Run a function **n** times.
|
785
|
+
function times(n, iteratee, context) {
|
786
|
+
var accum = Array(Math.max(0, n));
|
787
|
+
iteratee = optimizeCb(iteratee, context, 1);
|
788
|
+
for (var i = 0; i < n; i++) accum[i] = iteratee(i);
|
789
|
+
return accum;
|
790
|
+
}
|
791
|
+
|
792
|
+
// Return a random integer between `min` and `max` (inclusive).
|
793
|
+
function random(min, max) {
|
794
|
+
if (max == null) {
|
795
|
+
max = min;
|
796
|
+
min = 0;
|
797
|
+
}
|
798
|
+
return min + Math.floor(Math.random() * (max - min + 1));
|
799
|
+
}
|
800
|
+
|
801
|
+
// A (possibly faster) way to get the current timestamp as an integer.
|
802
|
+
var now = Date.now || function() {
|
803
|
+
return new Date().getTime();
|
804
|
+
};
|
805
|
+
|
806
|
+
// Internal helper to generate functions for escaping and unescaping strings
|
807
|
+
// to/from HTML interpolation.
|
808
|
+
function createEscaper(map) {
|
809
|
+
var escaper = function(match) {
|
810
|
+
return map[match];
|
811
|
+
};
|
812
|
+
// Regexes for identifying a key that needs to be escaped.
|
813
|
+
var source = '(?:' + keys(map).join('|') + ')';
|
814
|
+
var testRegexp = RegExp(source);
|
815
|
+
var replaceRegexp = RegExp(source, 'g');
|
816
|
+
return function(string) {
|
817
|
+
string = string == null ? '' : '' + string;
|
818
|
+
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
|
819
|
+
};
|
820
|
+
}
|
821
|
+
|
822
|
+
// Internal list of HTML entities for escaping.
|
823
|
+
var escapeMap = {
|
824
|
+
'&': '&',
|
825
|
+
'<': '<',
|
826
|
+
'>': '>',
|
827
|
+
'"': '"',
|
828
|
+
"'": ''',
|
829
|
+
'`': '`'
|
830
|
+
};
|
831
|
+
|
832
|
+
// Function for escaping strings to HTML interpolation.
|
833
|
+
var _escape = createEscaper(escapeMap);
|
834
|
+
|
835
|
+
// Internal list of HTML entities for unescaping.
|
836
|
+
var unescapeMap = invert(escapeMap);
|
837
|
+
|
838
|
+
// Function for unescaping strings from HTML interpolation.
|
839
|
+
var _unescape = createEscaper(unescapeMap);
|
840
|
+
|
841
|
+
// By default, Underscore uses ERB-style template delimiters. Change the
|
842
|
+
// following template settings to use alternative delimiters.
|
843
|
+
var templateSettings = _.templateSettings = {
|
844
|
+
evaluate: /<%([\s\S]+?)%>/g,
|
845
|
+
interpolate: /<%=([\s\S]+?)%>/g,
|
846
|
+
escape: /<%-([\s\S]+?)%>/g
|
847
|
+
};
|
848
|
+
|
849
|
+
// When customizing `_.templateSettings`, if you don't want to define an
|
850
|
+
// interpolation, evaluation or escaping regex, we need one that is
|
851
|
+
// guaranteed not to match.
|
852
|
+
var noMatch = /(.)^/;
|
853
|
+
|
854
|
+
// Certain characters need to be escaped so that they can be put into a
|
855
|
+
// string literal.
|
856
|
+
var escapes = {
|
857
|
+
"'": "'",
|
858
|
+
'\\': '\\',
|
859
|
+
'\r': 'r',
|
860
|
+
'\n': 'n',
|
861
|
+
'\u2028': 'u2028',
|
862
|
+
'\u2029': 'u2029'
|
863
|
+
};
|
864
|
+
|
865
|
+
var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
|
866
|
+
|
867
|
+
function escapeChar(match) {
|
868
|
+
return '\\' + escapes[match];
|
869
|
+
}
|
870
|
+
|
871
|
+
// JavaScript micro-templating, similar to John Resig's implementation.
|
872
|
+
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
873
|
+
// and correctly escapes quotes within interpolated code.
|
874
|
+
// NB: `oldSettings` only exists for backwards compatibility.
|
875
|
+
function template(text, settings, oldSettings) {
|
876
|
+
if (!settings && oldSettings) settings = oldSettings;
|
877
|
+
settings = defaults({}, settings, _.templateSettings);
|
878
|
+
|
879
|
+
// Combine delimiters into one regular expression via alternation.
|
880
|
+
var matcher = RegExp([
|
881
|
+
(settings.escape || noMatch).source,
|
882
|
+
(settings.interpolate || noMatch).source,
|
883
|
+
(settings.evaluate || noMatch).source
|
884
|
+
].join('|') + '|$', 'g');
|
885
|
+
|
886
|
+
// Compile the template source, escaping string literals appropriately.
|
887
|
+
var index = 0;
|
888
|
+
var source = "__p+='";
|
889
|
+
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
|
890
|
+
source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
|
891
|
+
index = offset + match.length;
|
892
|
+
|
893
|
+
if (escape) {
|
894
|
+
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
|
895
|
+
} else if (interpolate) {
|
896
|
+
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
|
897
|
+
} else if (evaluate) {
|
898
|
+
source += "';\n" + evaluate + "\n__p+='";
|
899
|
+
}
|
900
|
+
|
901
|
+
// Adobe VMs need the match returned to produce the correct offset.
|
902
|
+
return match;
|
903
|
+
});
|
904
|
+
source += "';\n";
|
905
|
+
|
906
|
+
// If a variable is not specified, place data values in local scope.
|
907
|
+
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
|
908
|
+
|
909
|
+
source = "var __t,__p='',__j=Array.prototype.join," +
|
910
|
+
"print=function(){__p+=__j.call(arguments,'');};\n" +
|
911
|
+
source + 'return __p;\n';
|
912
|
+
|
913
|
+
var render;
|
914
|
+
try {
|
915
|
+
render = new Function(settings.variable || 'obj', '_', source);
|
916
|
+
} catch (e) {
|
917
|
+
e.source = source;
|
918
|
+
throw e;
|
919
|
+
}
|
920
|
+
|
921
|
+
var template = function(data) {
|
922
|
+
return render.call(this, data, _);
|
923
|
+
};
|
924
|
+
|
925
|
+
// Provide the compiled source as a convenience for precompilation.
|
926
|
+
var argument = settings.variable || 'obj';
|
927
|
+
template.source = 'function(' + argument + '){\n' + source + '}';
|
928
|
+
|
929
|
+
return template;
|
930
|
+
}
|
931
|
+
|
932
|
+
// Traverses the children of `obj` along `path`. If a child is a function, it
|
933
|
+
// is invoked with its parent as context. Returns the value of the final
|
934
|
+
// child, or `fallback` if any child is undefined.
|
935
|
+
function result(obj, path, fallback) {
|
936
|
+
path = toPath$1(path);
|
937
|
+
var length = path.length;
|
938
|
+
if (!length) {
|
939
|
+
return isFunction$1(fallback) ? fallback.call(obj) : fallback;
|
940
|
+
}
|
941
|
+
for (var i = 0; i < length; i++) {
|
942
|
+
var prop = obj == null ? void 0 : obj[path[i]];
|
943
|
+
if (prop === void 0) {
|
944
|
+
prop = fallback;
|
945
|
+
i = length; // Ensure we don't continue iterating.
|
946
|
+
}
|
947
|
+
obj = isFunction$1(prop) ? prop.call(obj) : prop;
|
948
|
+
}
|
949
|
+
return obj;
|
950
|
+
}
|
951
|
+
|
952
|
+
// Generate a unique integer id (unique within the entire client session).
|
953
|
+
// Useful for temporary DOM ids.
|
954
|
+
var idCounter = 0;
|
955
|
+
function uniqueId(prefix) {
|
956
|
+
var id = ++idCounter + '';
|
957
|
+
return prefix ? prefix + id : id;
|
958
|
+
}
|
959
|
+
|
960
|
+
// Start chaining a wrapped Underscore object.
|
961
|
+
function chain(obj) {
|
962
|
+
var instance = _(obj);
|
963
|
+
instance._chain = true;
|
964
|
+
return instance;
|
965
|
+
}
|
966
|
+
|
967
|
+
// Internal function to execute `sourceFunc` bound to `context` with optional
|
968
|
+
// `args`. Determines whether to execute a function as a constructor or as a
|
969
|
+
// normal function.
|
970
|
+
function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
|
971
|
+
if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
|
972
|
+
var self = baseCreate(sourceFunc.prototype);
|
973
|
+
var result = sourceFunc.apply(self, args);
|
974
|
+
if (isObject(result)) return result;
|
975
|
+
return self;
|
976
|
+
}
|
977
|
+
|
978
|
+
// Partially apply a function by creating a version that has had some of its
|
979
|
+
// arguments pre-filled, without changing its dynamic `this` context. `_` acts
|
980
|
+
// as a placeholder by default, allowing any combination of arguments to be
|
981
|
+
// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
|
982
|
+
var partial = restArguments(function(func, boundArgs) {
|
983
|
+
var placeholder = partial.placeholder;
|
984
|
+
var bound = function() {
|
985
|
+
var position = 0, length = boundArgs.length;
|
986
|
+
var args = Array(length);
|
987
|
+
for (var i = 0; i < length; i++) {
|
988
|
+
args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
|
989
|
+
}
|
990
|
+
while (position < arguments.length) args.push(arguments[position++]);
|
991
|
+
return executeBound(func, bound, this, this, args);
|
992
|
+
};
|
993
|
+
return bound;
|
994
|
+
});
|
995
|
+
|
996
|
+
partial.placeholder = _;
|
997
|
+
|
998
|
+
// Create a function bound to a given object (assigning `this`, and arguments,
|
999
|
+
// optionally).
|
1000
|
+
var bind = restArguments(function(func, context, args) {
|
1001
|
+
if (!isFunction$1(func)) throw new TypeError('Bind must be called on a function');
|
1002
|
+
var bound = restArguments(function(callArgs) {
|
1003
|
+
return executeBound(func, bound, context, this, args.concat(callArgs));
|
1004
|
+
});
|
1005
|
+
return bound;
|
1006
|
+
});
|
1007
|
+
|
1008
|
+
// Internal helper for collection methods to determine whether a collection
|
1009
|
+
// should be iterated as an array or as an object.
|
1010
|
+
// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
|
1011
|
+
// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
|
1012
|
+
var isArrayLike = createSizePropertyCheck(getLength);
|
1013
|
+
|
1014
|
+
// Internal implementation of a recursive `flatten` function.
|
1015
|
+
function flatten(input, depth, strict, output) {
|
1016
|
+
output = output || [];
|
1017
|
+
if (!depth && depth !== 0) {
|
1018
|
+
depth = Infinity;
|
1019
|
+
} else if (depth <= 0) {
|
1020
|
+
return output.concat(input);
|
1021
|
+
}
|
1022
|
+
var idx = output.length;
|
1023
|
+
for (var i = 0, length = getLength(input); i < length; i++) {
|
1024
|
+
var value = input[i];
|
1025
|
+
if (isArrayLike(value) && (isArray(value) || isArguments$1(value))) {
|
1026
|
+
// Flatten current level of array or arguments object.
|
1027
|
+
if (depth > 1) {
|
1028
|
+
flatten(value, depth - 1, strict, output);
|
1029
|
+
idx = output.length;
|
1030
|
+
} else {
|
1031
|
+
var j = 0, len = value.length;
|
1032
|
+
while (j < len) output[idx++] = value[j++];
|
1033
|
+
}
|
1034
|
+
} else if (!strict) {
|
1035
|
+
output[idx++] = value;
|
1036
|
+
}
|
1037
|
+
}
|
1038
|
+
return output;
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
// Bind a number of an object's methods to that object. Remaining arguments
|
1042
|
+
// are the method names to be bound. Useful for ensuring that all callbacks
|
1043
|
+
// defined on an object belong to it.
|
1044
|
+
var bindAll = restArguments(function(obj, keys) {
|
1045
|
+
keys = flatten(keys, false, false);
|
1046
|
+
var index = keys.length;
|
1047
|
+
if (index < 1) throw new Error('bindAll must be passed function names');
|
1048
|
+
while (index--) {
|
1049
|
+
var key = keys[index];
|
1050
|
+
obj[key] = bind(obj[key], obj);
|
1051
|
+
}
|
1052
|
+
return obj;
|
1053
|
+
});
|
1054
|
+
|
1055
|
+
// Memoize an expensive function by storing its results.
|
1056
|
+
function memoize(func, hasher) {
|
1057
|
+
var memoize = function(key) {
|
1058
|
+
var cache = memoize.cache;
|
1059
|
+
var address = '' + (hasher ? hasher.apply(this, arguments) : key);
|
1060
|
+
if (!has(cache, address)) cache[address] = func.apply(this, arguments);
|
1061
|
+
return cache[address];
|
1062
|
+
};
|
1063
|
+
memoize.cache = {};
|
1064
|
+
return memoize;
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
// Delays a function for the given number of milliseconds, and then calls
|
1068
|
+
// it with the arguments supplied.
|
1069
|
+
var delay = restArguments(function(func, wait, args) {
|
1070
|
+
return setTimeout(function() {
|
1071
|
+
return func.apply(null, args);
|
1072
|
+
}, wait);
|
1073
|
+
});
|
1074
|
+
|
1075
|
+
// Defers a function, scheduling it to run after the current call stack has
|
1076
|
+
// cleared.
|
1077
|
+
var defer = partial(delay, _, 1);
|
1078
|
+
|
1079
|
+
// Returns a function, that, when invoked, will only be triggered at most once
|
1080
|
+
// during a given window of time. Normally, the throttled function will run
|
1081
|
+
// as much as it can, without ever going more than once per `wait` duration;
|
1082
|
+
// but if you'd like to disable the execution on the leading edge, pass
|
1083
|
+
// `{leading: false}`. To disable execution on the trailing edge, ditto.
|
1084
|
+
function throttle(func, wait, options) {
|
1085
|
+
var timeout, context, args, result;
|
1086
|
+
var previous = 0;
|
1087
|
+
if (!options) options = {};
|
1088
|
+
|
1089
|
+
var later = function() {
|
1090
|
+
previous = options.leading === false ? 0 : now();
|
1091
|
+
timeout = null;
|
1092
|
+
result = func.apply(context, args);
|
1093
|
+
if (!timeout) context = args = null;
|
1094
|
+
};
|
1095
|
+
|
1096
|
+
var throttled = function() {
|
1097
|
+
var _now = now();
|
1098
|
+
if (!previous && options.leading === false) previous = _now;
|
1099
|
+
var remaining = wait - (_now - previous);
|
1100
|
+
context = this;
|
1101
|
+
args = arguments;
|
1102
|
+
if (remaining <= 0 || remaining > wait) {
|
1103
|
+
if (timeout) {
|
1104
|
+
clearTimeout(timeout);
|
1105
|
+
timeout = null;
|
1106
|
+
}
|
1107
|
+
previous = _now;
|
1108
|
+
result = func.apply(context, args);
|
1109
|
+
if (!timeout) context = args = null;
|
1110
|
+
} else if (!timeout && options.trailing !== false) {
|
1111
|
+
timeout = setTimeout(later, remaining);
|
1112
|
+
}
|
1113
|
+
return result;
|
1114
|
+
};
|
1115
|
+
|
1116
|
+
throttled.cancel = function() {
|
1117
|
+
clearTimeout(timeout);
|
1118
|
+
previous = 0;
|
1119
|
+
timeout = context = args = null;
|
1120
|
+
};
|
1121
|
+
|
1122
|
+
return throttled;
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
// When a sequence of calls of the returned function ends, the argument
|
1126
|
+
// function is triggered. The end of a sequence is defined by the `wait`
|
1127
|
+
// parameter. If `immediate` is passed, the argument function will be
|
1128
|
+
// triggered at the beginning of the sequence instead of at the end.
|
1129
|
+
function debounce(func, wait, immediate) {
|
1130
|
+
var timeout, result;
|
1131
|
+
|
1132
|
+
var later = function(context, args) {
|
1133
|
+
timeout = null;
|
1134
|
+
if (args) result = func.apply(context, args);
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
var debounced = restArguments(function(args) {
|
1138
|
+
if (timeout) clearTimeout(timeout);
|
1139
|
+
if (immediate) {
|
1140
|
+
var callNow = !timeout;
|
1141
|
+
timeout = setTimeout(later, wait);
|
1142
|
+
if (callNow) result = func.apply(this, args);
|
1143
|
+
} else {
|
1144
|
+
timeout = delay(later, wait, this, args);
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
return result;
|
1148
|
+
});
|
1149
|
+
|
1150
|
+
debounced.cancel = function() {
|
1151
|
+
clearTimeout(timeout);
|
1152
|
+
timeout = null;
|
1153
|
+
};
|
1154
|
+
|
1155
|
+
return debounced;
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
// Returns the first function passed as an argument to the second,
|
1159
|
+
// allowing you to adjust arguments, run code before and after, and
|
1160
|
+
// conditionally execute the original function.
|
1161
|
+
function wrap(func, wrapper) {
|
1162
|
+
return partial(wrapper, func);
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
// Returns a negated version of the passed-in predicate.
|
1166
|
+
function negate(predicate) {
|
1167
|
+
return function() {
|
1168
|
+
return !predicate.apply(this, arguments);
|
1169
|
+
};
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
// Returns a function that is the composition of a list of functions, each
|
1173
|
+
// consuming the return value of the function that follows.
|
1174
|
+
function compose() {
|
1175
|
+
var args = arguments;
|
1176
|
+
var start = args.length - 1;
|
1177
|
+
return function() {
|
1178
|
+
var i = start;
|
1179
|
+
var result = args[start].apply(this, arguments);
|
1180
|
+
while (i--) result = args[i].call(this, result);
|
1181
|
+
return result;
|
1182
|
+
};
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
// Returns a function that will only be executed on and after the Nth call.
|
1186
|
+
function after(times, func) {
|
1187
|
+
return function() {
|
1188
|
+
if (--times < 1) {
|
1189
|
+
return func.apply(this, arguments);
|
1190
|
+
}
|
1191
|
+
};
|
1192
|
+
}
|
1193
|
+
|
1194
|
+
// Returns a function that will only be executed up to (but not including) the
|
1195
|
+
// Nth call.
|
1196
|
+
function before(times, func) {
|
1197
|
+
var memo;
|
1198
|
+
return function() {
|
1199
|
+
if (--times > 0) {
|
1200
|
+
memo = func.apply(this, arguments);
|
1201
|
+
}
|
1202
|
+
if (times <= 1) func = null;
|
1203
|
+
return memo;
|
1204
|
+
};
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
// Returns a function that will be executed at most one time, no matter how
|
1208
|
+
// often you call it. Useful for lazy initialization.
|
1209
|
+
var once = partial(before, 2);
|
1210
|
+
|
1211
|
+
// Returns the first key on an object that passes a truth test.
|
1212
|
+
function findKey(obj, predicate, context) {
|
1213
|
+
predicate = cb(predicate, context);
|
1214
|
+
var _keys = keys(obj), key;
|
1215
|
+
for (var i = 0, length = _keys.length; i < length; i++) {
|
1216
|
+
key = _keys[i];
|
1217
|
+
if (predicate(obj[key], key, obj)) return key;
|
1218
|
+
}
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
// Internal function to generate `_.findIndex` and `_.findLastIndex`.
|
1222
|
+
function createPredicateIndexFinder(dir) {
|
1223
|
+
return function(array, predicate, context) {
|
1224
|
+
predicate = cb(predicate, context);
|
1225
|
+
var length = getLength(array);
|
1226
|
+
var index = dir > 0 ? 0 : length - 1;
|
1227
|
+
for (; index >= 0 && index < length; index += dir) {
|
1228
|
+
if (predicate(array[index], index, array)) return index;
|
1229
|
+
}
|
1230
|
+
return -1;
|
1231
|
+
};
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
// Returns the first index on an array-like that passes a truth test.
|
1235
|
+
var findIndex = createPredicateIndexFinder(1);
|
1236
|
+
|
1237
|
+
// Returns the last index on an array-like that passes a truth test.
|
1238
|
+
var findLastIndex = createPredicateIndexFinder(-1);
|
1239
|
+
|
1240
|
+
// Use a comparator function to figure out the smallest index at which
|
1241
|
+
// an object should be inserted so as to maintain order. Uses binary search.
|
1242
|
+
function sortedIndex(array, obj, iteratee, context) {
|
1243
|
+
iteratee = cb(iteratee, context, 1);
|
1244
|
+
var value = iteratee(obj);
|
1245
|
+
var low = 0, high = getLength(array);
|
1246
|
+
while (low < high) {
|
1247
|
+
var mid = Math.floor((low + high) / 2);
|
1248
|
+
if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
|
1249
|
+
}
|
1250
|
+
return low;
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
|
1254
|
+
function createIndexFinder(dir, predicateFind, sortedIndex) {
|
1255
|
+
return function(array, item, idx) {
|
1256
|
+
var i = 0, length = getLength(array);
|
1257
|
+
if (typeof idx == 'number') {
|
1258
|
+
if (dir > 0) {
|
1259
|
+
i = idx >= 0 ? idx : Math.max(idx + length, i);
|
1260
|
+
} else {
|
1261
|
+
length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
|
1262
|
+
}
|
1263
|
+
} else if (sortedIndex && idx && length) {
|
1264
|
+
idx = sortedIndex(array, item);
|
1265
|
+
return array[idx] === item ? idx : -1;
|
1266
|
+
}
|
1267
|
+
if (item !== item) {
|
1268
|
+
idx = predicateFind(slice.call(array, i, length), isNaN$1);
|
1269
|
+
return idx >= 0 ? idx + i : -1;
|
1270
|
+
}
|
1271
|
+
for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
|
1272
|
+
if (array[idx] === item) return idx;
|
1273
|
+
}
|
1274
|
+
return -1;
|
1275
|
+
};
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
// Return the position of the first occurrence of an item in an array,
|
1279
|
+
// or -1 if the item is not included in the array.
|
1280
|
+
// If the array is large and already in sort order, pass `true`
|
1281
|
+
// for **isSorted** to use binary search.
|
1282
|
+
var indexOf = createIndexFinder(1, findIndex, sortedIndex);
|
1283
|
+
|
1284
|
+
// Return the position of the last occurrence of an item in an array,
|
1285
|
+
// or -1 if the item is not included in the array.
|
1286
|
+
var lastIndexOf = createIndexFinder(-1, findLastIndex);
|
1287
|
+
|
1288
|
+
// Return the first value which passes a truth test.
|
1289
|
+
function find(obj, predicate, context) {
|
1290
|
+
var keyFinder = isArrayLike(obj) ? findIndex : findKey;
|
1291
|
+
var key = keyFinder(obj, predicate, context);
|
1292
|
+
if (key !== void 0 && key !== -1) return obj[key];
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
// Convenience version of a common use case of `_.find`: getting the first
|
1296
|
+
// object containing specific `key:value` pairs.
|
1297
|
+
function findWhere(obj, attrs) {
|
1298
|
+
return find(obj, matcher(attrs));
|
1299
|
+
}
|
1300
|
+
|
1301
|
+
// The cornerstone for collection functions, an `each`
|
1302
|
+
// implementation, aka `forEach`.
|
1303
|
+
// Handles raw objects in addition to array-likes. Treats all
|
1304
|
+
// sparse array-likes as if they were dense.
|
1305
|
+
function each(obj, iteratee, context) {
|
1306
|
+
iteratee = optimizeCb(iteratee, context);
|
1307
|
+
var i, length;
|
1308
|
+
if (isArrayLike(obj)) {
|
1309
|
+
for (i = 0, length = obj.length; i < length; i++) {
|
1310
|
+
iteratee(obj[i], i, obj);
|
1311
|
+
}
|
1312
|
+
} else {
|
1313
|
+
var _keys = keys(obj);
|
1314
|
+
for (i = 0, length = _keys.length; i < length; i++) {
|
1315
|
+
iteratee(obj[_keys[i]], _keys[i], obj);
|
1316
|
+
}
|
1317
|
+
}
|
1318
|
+
return obj;
|
1319
|
+
}
|
1320
|
+
|
1321
|
+
// Return the results of applying the iteratee to each element.
|
1322
|
+
function map(obj, iteratee, context) {
|
1323
|
+
iteratee = cb(iteratee, context);
|
1324
|
+
var _keys = !isArrayLike(obj) && keys(obj),
|
1325
|
+
length = (_keys || obj).length,
|
1326
|
+
results = Array(length);
|
1327
|
+
for (var index = 0; index < length; index++) {
|
1328
|
+
var currentKey = _keys ? _keys[index] : index;
|
1329
|
+
results[index] = iteratee(obj[currentKey], currentKey, obj);
|
1330
|
+
}
|
1331
|
+
return results;
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
// Internal helper to create a reducing function, iterating left or right.
|
1335
|
+
function createReduce(dir) {
|
1336
|
+
// Wrap code that reassigns argument variables in a separate function than
|
1337
|
+
// the one that accesses `arguments.length` to avoid a perf hit. (#1991)
|
1338
|
+
var reducer = function(obj, iteratee, memo, initial) {
|
1339
|
+
var _keys = !isArrayLike(obj) && keys(obj),
|
1340
|
+
length = (_keys || obj).length,
|
1341
|
+
index = dir > 0 ? 0 : length - 1;
|
1342
|
+
if (!initial) {
|
1343
|
+
memo = obj[_keys ? _keys[index] : index];
|
1344
|
+
index += dir;
|
1345
|
+
}
|
1346
|
+
for (; index >= 0 && index < length; index += dir) {
|
1347
|
+
var currentKey = _keys ? _keys[index] : index;
|
1348
|
+
memo = iteratee(memo, obj[currentKey], currentKey, obj);
|
1349
|
+
}
|
1350
|
+
return memo;
|
1351
|
+
};
|
1352
|
+
|
1353
|
+
return function(obj, iteratee, memo, context) {
|
1354
|
+
var initial = arguments.length >= 3;
|
1355
|
+
return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial);
|
1356
|
+
};
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
// **Reduce** builds up a single result from a list of values, aka `inject`,
|
1360
|
+
// or `foldl`.
|
1361
|
+
var reduce = createReduce(1);
|
1362
|
+
|
1363
|
+
// The right-associative version of reduce, also known as `foldr`.
|
1364
|
+
var reduceRight = createReduce(-1);
|
1365
|
+
|
1366
|
+
// Return all the elements that pass a truth test.
|
1367
|
+
function filter(obj, predicate, context) {
|
1368
|
+
var results = [];
|
1369
|
+
predicate = cb(predicate, context);
|
1370
|
+
each(obj, function(value, index, list) {
|
1371
|
+
if (predicate(value, index, list)) results.push(value);
|
1372
|
+
});
|
1373
|
+
return results;
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
// Return all the elements for which a truth test fails.
|
1377
|
+
function reject(obj, predicate, context) {
|
1378
|
+
return filter(obj, negate(cb(predicate)), context);
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
// Determine whether all of the elements pass a truth test.
|
1382
|
+
function every(obj, predicate, context) {
|
1383
|
+
predicate = cb(predicate, context);
|
1384
|
+
var _keys = !isArrayLike(obj) && keys(obj),
|
1385
|
+
length = (_keys || obj).length;
|
1386
|
+
for (var index = 0; index < length; index++) {
|
1387
|
+
var currentKey = _keys ? _keys[index] : index;
|
1388
|
+
if (!predicate(obj[currentKey], currentKey, obj)) return false;
|
1389
|
+
}
|
1390
|
+
return true;
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
// Determine if at least one element in the object passes a truth test.
|
1394
|
+
function some(obj, predicate, context) {
|
1395
|
+
predicate = cb(predicate, context);
|
1396
|
+
var _keys = !isArrayLike(obj) && keys(obj),
|
1397
|
+
length = (_keys || obj).length;
|
1398
|
+
for (var index = 0; index < length; index++) {
|
1399
|
+
var currentKey = _keys ? _keys[index] : index;
|
1400
|
+
if (predicate(obj[currentKey], currentKey, obj)) return true;
|
1401
|
+
}
|
1402
|
+
return false;
|
1403
|
+
}
|
1404
|
+
|
1405
|
+
// Determine if the array or object contains a given item (using `===`).
|
1406
|
+
function contains(obj, item, fromIndex, guard) {
|
1407
|
+
if (!isArrayLike(obj)) obj = values(obj);
|
1408
|
+
if (typeof fromIndex != 'number' || guard) fromIndex = 0;
|
1409
|
+
return indexOf(obj, item, fromIndex) >= 0;
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
// Invoke a method (with arguments) on every item in a collection.
|
1413
|
+
var invoke = restArguments(function(obj, path, args) {
|
1414
|
+
var contextPath, func;
|
1415
|
+
if (isFunction$1(path)) {
|
1416
|
+
func = path;
|
1417
|
+
} else {
|
1418
|
+
path = toPath$1(path);
|
1419
|
+
contextPath = path.slice(0, -1);
|
1420
|
+
path = path[path.length - 1];
|
1421
|
+
}
|
1422
|
+
return map(obj, function(context) {
|
1423
|
+
var method = func;
|
1424
|
+
if (!method) {
|
1425
|
+
if (contextPath && contextPath.length) {
|
1426
|
+
context = deepGet(context, contextPath);
|
1427
|
+
}
|
1428
|
+
if (context == null) return void 0;
|
1429
|
+
method = context[path];
|
1430
|
+
}
|
1431
|
+
return method == null ? method : method.apply(context, args);
|
1432
|
+
});
|
1433
|
+
});
|
1434
|
+
|
1435
|
+
// Convenience version of a common use case of `_.map`: fetching a property.
|
1436
|
+
function pluck(obj, key) {
|
1437
|
+
return map(obj, property(key));
|
1438
|
+
}
|
1439
|
+
|
1440
|
+
// Convenience version of a common use case of `_.filter`: selecting only
|
1441
|
+
// objects containing specific `key:value` pairs.
|
1442
|
+
function where(obj, attrs) {
|
1443
|
+
return filter(obj, matcher(attrs));
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
// Return the maximum element (or element-based computation).
|
1447
|
+
function max(obj, iteratee, context) {
|
1448
|
+
var result = -Infinity, lastComputed = -Infinity,
|
1449
|
+
value, computed;
|
1450
|
+
if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
|
1451
|
+
obj = isArrayLike(obj) ? obj : values(obj);
|
1452
|
+
for (var i = 0, length = obj.length; i < length; i++) {
|
1453
|
+
value = obj[i];
|
1454
|
+
if (value != null && value > result) {
|
1455
|
+
result = value;
|
1456
|
+
}
|
1457
|
+
}
|
1458
|
+
} else {
|
1459
|
+
iteratee = cb(iteratee, context);
|
1460
|
+
each(obj, function(v, index, list) {
|
1461
|
+
computed = iteratee(v, index, list);
|
1462
|
+
if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
|
1463
|
+
result = v;
|
1464
|
+
lastComputed = computed;
|
1465
|
+
}
|
1466
|
+
});
|
1467
|
+
}
|
1468
|
+
return result;
|
1469
|
+
}
|
1470
|
+
|
1471
|
+
// Return the minimum element (or element-based computation).
|
1472
|
+
function min(obj, iteratee, context) {
|
1473
|
+
var result = Infinity, lastComputed = Infinity,
|
1474
|
+
value, computed;
|
1475
|
+
if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
|
1476
|
+
obj = isArrayLike(obj) ? obj : values(obj);
|
1477
|
+
for (var i = 0, length = obj.length; i < length; i++) {
|
1478
|
+
value = obj[i];
|
1479
|
+
if (value != null && value < result) {
|
1480
|
+
result = value;
|
1481
|
+
}
|
1482
|
+
}
|
1483
|
+
} else {
|
1484
|
+
iteratee = cb(iteratee, context);
|
1485
|
+
each(obj, function(v, index, list) {
|
1486
|
+
computed = iteratee(v, index, list);
|
1487
|
+
if (computed < lastComputed || computed === Infinity && result === Infinity) {
|
1488
|
+
result = v;
|
1489
|
+
lastComputed = computed;
|
1490
|
+
}
|
1491
|
+
});
|
1492
|
+
}
|
1493
|
+
return result;
|
1494
|
+
}
|
1495
|
+
|
1496
|
+
// Sample **n** random values from a collection using the modern version of the
|
1497
|
+
// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
|
1498
|
+
// If **n** is not specified, returns a single random element.
|
1499
|
+
// The internal `guard` argument allows it to work with `_.map`.
|
1500
|
+
function sample(obj, n, guard) {
|
1501
|
+
if (n == null || guard) {
|
1502
|
+
if (!isArrayLike(obj)) obj = values(obj);
|
1503
|
+
return obj[random(obj.length - 1)];
|
1504
|
+
}
|
1505
|
+
var sample = isArrayLike(obj) ? clone(obj) : values(obj);
|
1506
|
+
var length = getLength(sample);
|
1507
|
+
n = Math.max(Math.min(n, length), 0);
|
1508
|
+
var last = length - 1;
|
1509
|
+
for (var index = 0; index < n; index++) {
|
1510
|
+
var rand = random(index, last);
|
1511
|
+
var temp = sample[index];
|
1512
|
+
sample[index] = sample[rand];
|
1513
|
+
sample[rand] = temp;
|
1514
|
+
}
|
1515
|
+
return sample.slice(0, n);
|
1516
|
+
}
|
1517
|
+
|
1518
|
+
// Shuffle a collection.
|
1519
|
+
function shuffle(obj) {
|
1520
|
+
return sample(obj, Infinity);
|
1521
|
+
}
|
1522
|
+
|
1523
|
+
// Sort the object's values by a criterion produced by an iteratee.
|
1524
|
+
function sortBy(obj, iteratee, context) {
|
1525
|
+
var index = 0;
|
1526
|
+
iteratee = cb(iteratee, context);
|
1527
|
+
return pluck(map(obj, function(value, key, list) {
|
1528
|
+
return {
|
1529
|
+
value: value,
|
1530
|
+
index: index++,
|
1531
|
+
criteria: iteratee(value, key, list)
|
1532
|
+
};
|
1533
|
+
}).sort(function(left, right) {
|
1534
|
+
var a = left.criteria;
|
1535
|
+
var b = right.criteria;
|
1536
|
+
if (a !== b) {
|
1537
|
+
if (a > b || a === void 0) return 1;
|
1538
|
+
if (a < b || b === void 0) return -1;
|
1539
|
+
}
|
1540
|
+
return left.index - right.index;
|
1541
|
+
}), 'value');
|
1542
|
+
}
|
1543
|
+
|
1544
|
+
// An internal function used for aggregate "group by" operations.
|
1545
|
+
function group(behavior, partition) {
|
1546
|
+
return function(obj, iteratee, context) {
|
1547
|
+
var result = partition ? [[], []] : {};
|
1548
|
+
iteratee = cb(iteratee, context);
|
1549
|
+
each(obj, function(value, index) {
|
1550
|
+
var key = iteratee(value, index, obj);
|
1551
|
+
behavior(result, value, key);
|
1552
|
+
});
|
1553
|
+
return result;
|
1554
|
+
};
|
1555
|
+
}
|
1556
|
+
|
1557
|
+
// Groups the object's values by a criterion. Pass either a string attribute
|
1558
|
+
// to group by, or a function that returns the criterion.
|
1559
|
+
var groupBy = group(function(result, value, key) {
|
1560
|
+
if (has(result, key)) result[key].push(value); else result[key] = [value];
|
1561
|
+
});
|
1562
|
+
|
1563
|
+
// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
|
1564
|
+
// when you know that your index values will be unique.
|
1565
|
+
var indexBy = group(function(result, value, key) {
|
1566
|
+
result[key] = value;
|
1567
|
+
});
|
1568
|
+
|
1569
|
+
// Counts instances of an object that group by a certain criterion. Pass
|
1570
|
+
// either a string attribute to count by, or a function that returns the
|
1571
|
+
// criterion.
|
1572
|
+
var countBy = group(function(result, value, key) {
|
1573
|
+
if (has(result, key)) result[key]++; else result[key] = 1;
|
1574
|
+
});
|
1575
|
+
|
1576
|
+
// Split a collection into two arrays: one whose elements all pass the given
|
1577
|
+
// truth test, and one whose elements all do not pass the truth test.
|
1578
|
+
var partition = group(function(result, value, pass) {
|
1579
|
+
result[pass ? 0 : 1].push(value);
|
1580
|
+
}, true);
|
1581
|
+
|
1582
|
+
// Safely create a real, live array from anything iterable.
|
1583
|
+
var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
|
1584
|
+
function toArray(obj) {
|
1585
|
+
if (!obj) return [];
|
1586
|
+
if (isArray(obj)) return slice.call(obj);
|
1587
|
+
if (isString(obj)) {
|
1588
|
+
// Keep surrogate pair characters together.
|
1589
|
+
return obj.match(reStrSymbol);
|
1590
|
+
}
|
1591
|
+
if (isArrayLike(obj)) return map(obj, identity);
|
1592
|
+
return values(obj);
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
// Return the number of elements in a collection.
|
1596
|
+
function size(obj) {
|
1597
|
+
if (obj == null) return 0;
|
1598
|
+
return isArrayLike(obj) ? obj.length : keys(obj).length;
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
// Internal `_.pick` helper function to determine whether `key` is an enumerable
|
1602
|
+
// property name of `obj`.
|
1603
|
+
function keyInObj(value, key, obj) {
|
1604
|
+
return key in obj;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
// Return a copy of the object only containing the allowed properties.
|
1608
|
+
var pick = restArguments(function(obj, keys) {
|
1609
|
+
var result = {}, iteratee = keys[0];
|
1610
|
+
if (obj == null) return result;
|
1611
|
+
if (isFunction$1(iteratee)) {
|
1612
|
+
if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);
|
1613
|
+
keys = allKeys(obj);
|
1614
|
+
} else {
|
1615
|
+
iteratee = keyInObj;
|
1616
|
+
keys = flatten(keys, false, false);
|
1617
|
+
obj = Object(obj);
|
1618
|
+
}
|
1619
|
+
for (var i = 0, length = keys.length; i < length; i++) {
|
1620
|
+
var key = keys[i];
|
1621
|
+
var value = obj[key];
|
1622
|
+
if (iteratee(value, key, obj)) result[key] = value;
|
1623
|
+
}
|
1624
|
+
return result;
|
1625
|
+
});
|
1626
|
+
|
1627
|
+
// Return a copy of the object without the disallowed properties.
|
1628
|
+
var omit = restArguments(function(obj, keys) {
|
1629
|
+
var iteratee = keys[0], context;
|
1630
|
+
if (isFunction$1(iteratee)) {
|
1631
|
+
iteratee = negate(iteratee);
|
1632
|
+
if (keys.length > 1) context = keys[1];
|
1633
|
+
} else {
|
1634
|
+
keys = map(flatten(keys, false, false), String);
|
1635
|
+
iteratee = function(value, key) {
|
1636
|
+
return !contains(keys, key);
|
1637
|
+
};
|
1638
|
+
}
|
1639
|
+
return pick(obj, iteratee, context);
|
1640
|
+
});
|
1641
|
+
|
1642
|
+
// Returns everything but the last entry of the array. Especially useful on
|
1643
|
+
// the arguments object. Passing **n** will return all the values in
|
1644
|
+
// the array, excluding the last N.
|
1645
|
+
function initial(array, n, guard) {
|
1646
|
+
return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
// Get the first element of an array. Passing **n** will return the first N
|
1650
|
+
// values in the array. The **guard** check allows it to work with `_.map`.
|
1651
|
+
function first(array, n, guard) {
|
1652
|
+
if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
|
1653
|
+
if (n == null || guard) return array[0];
|
1654
|
+
return initial(array, array.length - n);
|
1655
|
+
}
|
1656
|
+
|
1657
|
+
// Returns everything but the first entry of the `array`. Especially useful on
|
1658
|
+
// the `arguments` object. Passing an **n** will return the rest N values in the
|
1659
|
+
// `array`.
|
1660
|
+
function rest(array, n, guard) {
|
1661
|
+
return slice.call(array, n == null || guard ? 1 : n);
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
// Get the last element of an array. Passing **n** will return the last N
|
1665
|
+
// values in the array.
|
1666
|
+
function last(array, n, guard) {
|
1667
|
+
if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
|
1668
|
+
if (n == null || guard) return array[array.length - 1];
|
1669
|
+
return rest(array, Math.max(0, array.length - n));
|
1670
|
+
}
|
1671
|
+
|
1672
|
+
// Trim out all falsy values from an array.
|
1673
|
+
function compact(array) {
|
1674
|
+
return filter(array, Boolean);
|
1675
|
+
}
|
1676
|
+
|
1677
|
+
// Flatten out an array, either recursively (by default), or up to `depth`.
|
1678
|
+
// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
|
1679
|
+
function flatten$1(array, depth) {
|
1680
|
+
return flatten(array, depth, false);
|
1681
|
+
}
|
1682
|
+
|
1683
|
+
// Take the difference between one array and a number of other arrays.
|
1684
|
+
// Only the elements present in just the first array will remain.
|
1685
|
+
var difference = restArguments(function(array, rest) {
|
1686
|
+
rest = flatten(rest, true, true);
|
1687
|
+
return filter(array, function(value){
|
1688
|
+
return !contains(rest, value);
|
1689
|
+
});
|
1690
|
+
});
|
1691
|
+
|
1692
|
+
// Return a version of the array that does not contain the specified value(s).
|
1693
|
+
var without = restArguments(function(array, otherArrays) {
|
1694
|
+
return difference(array, otherArrays);
|
1695
|
+
});
|
1696
|
+
|
1697
|
+
// Produce a duplicate-free version of the array. If the array has already
|
1698
|
+
// been sorted, you have the option of using a faster algorithm.
|
1699
|
+
// The faster algorithm will not work with an iteratee if the iteratee
|
1700
|
+
// is not a one-to-one function, so providing an iteratee will disable
|
1701
|
+
// the faster algorithm.
|
1702
|
+
function uniq(array, isSorted, iteratee, context) {
|
1703
|
+
if (!isBoolean(isSorted)) {
|
1704
|
+
context = iteratee;
|
1705
|
+
iteratee = isSorted;
|
1706
|
+
isSorted = false;
|
1707
|
+
}
|
1708
|
+
if (iteratee != null) iteratee = cb(iteratee, context);
|
1709
|
+
var result = [];
|
1710
|
+
var seen = [];
|
1711
|
+
for (var i = 0, length = getLength(array); i < length; i++) {
|
1712
|
+
var value = array[i],
|
1713
|
+
computed = iteratee ? iteratee(value, i, array) : value;
|
1714
|
+
if (isSorted && !iteratee) {
|
1715
|
+
if (!i || seen !== computed) result.push(value);
|
1716
|
+
seen = computed;
|
1717
|
+
} else if (iteratee) {
|
1718
|
+
if (!contains(seen, computed)) {
|
1719
|
+
seen.push(computed);
|
1720
|
+
result.push(value);
|
1721
|
+
}
|
1722
|
+
} else if (!contains(result, value)) {
|
1723
|
+
result.push(value);
|
1724
|
+
}
|
1725
|
+
}
|
1726
|
+
return result;
|
1727
|
+
}
|
1728
|
+
|
1729
|
+
// Produce an array that contains the union: each distinct element from all of
|
1730
|
+
// the passed-in arrays.
|
1731
|
+
var union = restArguments(function(arrays) {
|
1732
|
+
return uniq(flatten(arrays, true, true));
|
1733
|
+
});
|
1734
|
+
|
1735
|
+
// Produce an array that contains every item shared between all the
|
1736
|
+
// passed-in arrays.
|
1737
|
+
function intersection(array) {
|
1738
|
+
var result = [];
|
1739
|
+
var argsLength = arguments.length;
|
1740
|
+
for (var i = 0, length = getLength(array); i < length; i++) {
|
1741
|
+
var item = array[i];
|
1742
|
+
if (contains(result, item)) continue;
|
1743
|
+
var j;
|
1744
|
+
for (j = 1; j < argsLength; j++) {
|
1745
|
+
if (!contains(arguments[j], item)) break;
|
1746
|
+
}
|
1747
|
+
if (j === argsLength) result.push(item);
|
1748
|
+
}
|
1749
|
+
return result;
|
1750
|
+
}
|
1751
|
+
|
1752
|
+
// Complement of zip. Unzip accepts an array of arrays and groups
|
1753
|
+
// each array's elements on shared indices.
|
1754
|
+
function unzip(array) {
|
1755
|
+
var length = array && max(array, getLength).length || 0;
|
1756
|
+
var result = Array(length);
|
1757
|
+
|
1758
|
+
for (var index = 0; index < length; index++) {
|
1759
|
+
result[index] = pluck(array, index);
|
1760
|
+
}
|
1761
|
+
return result;
|
1762
|
+
}
|
1763
|
+
|
1764
|
+
// Zip together multiple lists into a single array -- elements that share
|
1765
|
+
// an index go together.
|
1766
|
+
var zip = restArguments(unzip);
|
1767
|
+
|
1768
|
+
// Converts lists into objects. Pass either a single array of `[key, value]`
|
1769
|
+
// pairs, or two parallel arrays of the same length -- one of keys, and one of
|
1770
|
+
// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
|
1771
|
+
function object(list, values) {
|
1772
|
+
var result = {};
|
1773
|
+
for (var i = 0, length = getLength(list); i < length; i++) {
|
1774
|
+
if (values) {
|
1775
|
+
result[list[i]] = values[i];
|
1776
|
+
} else {
|
1777
|
+
result[list[i][0]] = list[i][1];
|
1778
|
+
}
|
1779
|
+
}
|
1780
|
+
return result;
|
1781
|
+
}
|
1782
|
+
|
1783
|
+
// Generate an integer Array containing an arithmetic progression. A port of
|
1784
|
+
// the native Python `range()` function. See
|
1785
|
+
// [the Python documentation](https://docs.python.org/library/functions.html#range).
|
1786
|
+
function range(start, stop, step) {
|
1787
|
+
if (stop == null) {
|
1788
|
+
stop = start || 0;
|
1789
|
+
start = 0;
|
1790
|
+
}
|
1791
|
+
if (!step) {
|
1792
|
+
step = stop < start ? -1 : 1;
|
1793
|
+
}
|
1794
|
+
|
1795
|
+
var length = Math.max(Math.ceil((stop - start) / step), 0);
|
1796
|
+
var range = Array(length);
|
1797
|
+
|
1798
|
+
for (var idx = 0; idx < length; idx++, start += step) {
|
1799
|
+
range[idx] = start;
|
1800
|
+
}
|
1801
|
+
|
1802
|
+
return range;
|
1803
|
+
}
|
1804
|
+
|
1805
|
+
// Chunk a single array into multiple arrays, each containing `count` or fewer
|
1806
|
+
// items.
|
1807
|
+
function chunk(array, count) {
|
1808
|
+
if (count == null || count < 1) return [];
|
1809
|
+
var result = [];
|
1810
|
+
var i = 0, length = array.length;
|
1811
|
+
while (i < length) {
|
1812
|
+
result.push(slice.call(array, i, i += count));
|
1813
|
+
}
|
1814
|
+
return result;
|
1815
|
+
}
|
1816
|
+
|
1817
|
+
// Helper function to continue chaining intermediate results.
|
1818
|
+
function chainResult(instance, obj) {
|
1819
|
+
return instance._chain ? _(obj).chain() : obj;
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
// Add your own custom functions to the Underscore object.
|
1823
|
+
function mixin(obj) {
|
1824
|
+
each(functions(obj), function(name) {
|
1825
|
+
var func = _[name] = obj[name];
|
1826
|
+
_.prototype[name] = function() {
|
1827
|
+
var args = [this._wrapped];
|
1828
|
+
push.apply(args, arguments);
|
1829
|
+
return chainResult(this, func.apply(_, args));
|
1830
|
+
};
|
1831
|
+
});
|
1832
|
+
return _;
|
1833
|
+
}
|
1834
|
+
|
1835
|
+
// Add all mutator `Array` functions to the wrapper.
|
1836
|
+
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
|
1837
|
+
var method = ArrayProto[name];
|
1838
|
+
_.prototype[name] = function() {
|
1839
|
+
var obj = this._wrapped;
|
1840
|
+
if (obj != null) {
|
1841
|
+
method.apply(obj, arguments);
|
1842
|
+
if ((name === 'shift' || name === 'splice') && obj.length === 0) {
|
1843
|
+
delete obj[0];
|
1844
|
+
}
|
1845
|
+
}
|
1846
|
+
return chainResult(this, obj);
|
1847
|
+
};
|
1848
|
+
});
|
1849
|
+
|
1850
|
+
// Add all accessor `Array` functions to the wrapper.
|
1851
|
+
each(['concat', 'join', 'slice'], function(name) {
|
1852
|
+
var method = ArrayProto[name];
|
1853
|
+
_.prototype[name] = function() {
|
1854
|
+
var obj = this._wrapped;
|
1855
|
+
if (obj != null) obj = method.apply(obj, arguments);
|
1856
|
+
return chainResult(this, obj);
|
1857
|
+
};
|
1858
|
+
});
|
1859
|
+
|
1860
|
+
// Named Exports
|
1861
|
+
|
1862
|
+
var allExports = {
|
1863
|
+
__proto__: null,
|
1864
|
+
VERSION: VERSION,
|
1865
|
+
restArguments: restArguments,
|
1866
|
+
isObject: isObject,
|
1867
|
+
isNull: isNull,
|
1868
|
+
isUndefined: isUndefined,
|
1869
|
+
isBoolean: isBoolean,
|
1870
|
+
isElement: isElement,
|
1871
|
+
isString: isString,
|
1872
|
+
isNumber: isNumber,
|
1873
|
+
isDate: isDate,
|
1874
|
+
isRegExp: isRegExp,
|
1875
|
+
isError: isError,
|
1876
|
+
isSymbol: isSymbol,
|
1877
|
+
isArrayBuffer: isArrayBuffer,
|
1878
|
+
isDataView: isDataView$1,
|
1879
|
+
isArray: isArray,
|
1880
|
+
isFunction: isFunction$1,
|
1881
|
+
isArguments: isArguments$1,
|
1882
|
+
isFinite: isFinite$1,
|
1883
|
+
isNaN: isNaN$1,
|
1884
|
+
isTypedArray: isTypedArray$1,
|
1885
|
+
isEmpty: isEmpty,
|
1886
|
+
isMatch: isMatch,
|
1887
|
+
isEqual: isEqual,
|
1888
|
+
isMap: isMap,
|
1889
|
+
isWeakMap: isWeakMap,
|
1890
|
+
isSet: isSet,
|
1891
|
+
isWeakSet: isWeakSet,
|
1892
|
+
keys: keys,
|
1893
|
+
allKeys: allKeys,
|
1894
|
+
values: values,
|
1895
|
+
pairs: pairs,
|
1896
|
+
invert: invert,
|
1897
|
+
functions: functions,
|
1898
|
+
methods: functions,
|
1899
|
+
extend: extend,
|
1900
|
+
extendOwn: extendOwn,
|
1901
|
+
assign: extendOwn,
|
1902
|
+
defaults: defaults,
|
1903
|
+
create: create,
|
1904
|
+
clone: clone,
|
1905
|
+
tap: tap,
|
1906
|
+
get: get,
|
1907
|
+
has: has$1,
|
1908
|
+
mapObject: mapObject,
|
1909
|
+
identity: identity,
|
1910
|
+
constant: constant,
|
1911
|
+
noop: noop,
|
1912
|
+
toPath: toPath,
|
1913
|
+
property: property,
|
1914
|
+
propertyOf: propertyOf,
|
1915
|
+
matcher: matcher,
|
1916
|
+
matches: matcher,
|
1917
|
+
times: times,
|
1918
|
+
random: random,
|
1919
|
+
now: now,
|
1920
|
+
escape: _escape,
|
1921
|
+
unescape: _unescape,
|
1922
|
+
templateSettings: templateSettings,
|
1923
|
+
template: template,
|
1924
|
+
result: result,
|
1925
|
+
uniqueId: uniqueId,
|
1926
|
+
chain: chain,
|
1927
|
+
iteratee: iteratee,
|
1928
|
+
partial: partial,
|
1929
|
+
bind: bind,
|
1930
|
+
bindAll: bindAll,
|
1931
|
+
memoize: memoize,
|
1932
|
+
delay: delay,
|
1933
|
+
defer: defer,
|
1934
|
+
throttle: throttle,
|
1935
|
+
debounce: debounce,
|
1936
|
+
wrap: wrap,
|
1937
|
+
negate: negate,
|
1938
|
+
compose: compose,
|
1939
|
+
after: after,
|
1940
|
+
before: before,
|
1941
|
+
once: once,
|
1942
|
+
findKey: findKey,
|
1943
|
+
findIndex: findIndex,
|
1944
|
+
findLastIndex: findLastIndex,
|
1945
|
+
sortedIndex: sortedIndex,
|
1946
|
+
indexOf: indexOf,
|
1947
|
+
lastIndexOf: lastIndexOf,
|
1948
|
+
find: find,
|
1949
|
+
detect: find,
|
1950
|
+
findWhere: findWhere,
|
1951
|
+
each: each,
|
1952
|
+
forEach: each,
|
1953
|
+
map: map,
|
1954
|
+
collect: map,
|
1955
|
+
reduce: reduce,
|
1956
|
+
foldl: reduce,
|
1957
|
+
inject: reduce,
|
1958
|
+
reduceRight: reduceRight,
|
1959
|
+
foldr: reduceRight,
|
1960
|
+
filter: filter,
|
1961
|
+
select: filter,
|
1962
|
+
reject: reject,
|
1963
|
+
every: every,
|
1964
|
+
all: every,
|
1965
|
+
some: some,
|
1966
|
+
any: some,
|
1967
|
+
contains: contains,
|
1968
|
+
includes: contains,
|
1969
|
+
include: contains,
|
1970
|
+
invoke: invoke,
|
1971
|
+
pluck: pluck,
|
1972
|
+
where: where,
|
1973
|
+
max: max,
|
1974
|
+
min: min,
|
1975
|
+
shuffle: shuffle,
|
1976
|
+
sample: sample,
|
1977
|
+
sortBy: sortBy,
|
1978
|
+
groupBy: groupBy,
|
1979
|
+
indexBy: indexBy,
|
1980
|
+
countBy: countBy,
|
1981
|
+
partition: partition,
|
1982
|
+
toArray: toArray,
|
1983
|
+
size: size,
|
1984
|
+
pick: pick,
|
1985
|
+
omit: omit,
|
1986
|
+
first: first,
|
1987
|
+
head: first,
|
1988
|
+
take: first,
|
1989
|
+
initial: initial,
|
1990
|
+
last: last,
|
1991
|
+
rest: rest,
|
1992
|
+
tail: rest,
|
1993
|
+
drop: rest,
|
1994
|
+
compact: compact,
|
1995
|
+
flatten: flatten$1,
|
1996
|
+
without: without,
|
1997
|
+
uniq: uniq,
|
1998
|
+
unique: uniq,
|
1999
|
+
union: union,
|
2000
|
+
intersection: intersection,
|
2001
|
+
difference: difference,
|
2002
|
+
unzip: unzip,
|
2003
|
+
transpose: unzip,
|
2004
|
+
zip: zip,
|
2005
|
+
object: object,
|
2006
|
+
range: range,
|
2007
|
+
chunk: chunk,
|
2008
|
+
mixin: mixin,
|
2009
|
+
'default': _
|
2010
|
+
};
|
2011
|
+
|
2012
|
+
// Default Export
|
2013
|
+
|
2014
|
+
// Add all of the Underscore functions to the wrapper object.
|
2015
|
+
var _$1 = mixin(allExports);
|
2016
|
+
// Legacy Node.js API.
|
2017
|
+
_$1._ = _$1;
|
2018
|
+
|
2019
|
+
return _$1;
|
2020
|
+
|
2021
|
+
})));
|
2022
|
+
//# sourceMappingURL=underscore.js.map
|