Skip to content

Instantly share code, notes, and snippets.

@acouch
Last active August 29, 2015 14:21
Show Gist options
  • Save acouch/996977c50c3a7445e6db to your computer and use it in GitHub Desktop.
Save acouch/996977c50c3a7445e6db to your computer and use it in GitHub Desktop.
recline scope
This file has been truncated, but you can view the full file.
//////////////////////////////////////////////////////////////////////////
// //
// This is a generated file. You can view the original //
// source in your browser if your browser supports source maps. //
// //
// If you are using Chrome, open the Developer Tools and click the gear //
// icon in its lower right corner. In the General Settings panel, turn //
// on 'Enable source maps'. //
// //
// If you are using Firefox 23, go to `about:config` and set the //
// `devtools.debugger.source-maps-enabled` preference to true. //
// (The preference should be on by default in Firefox 24; versions //
// older than 23 do not support source maps.) //
// //
//////////////////////////////////////////////////////////////////////////
(function () {
/* Imports */
//var Meteor = Package.meteor.Meteor;
/* Package-scope variables */
var _, unit, times, duration, isVisible, animateTo, child, retval, matches, matches2, key, worksheet;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/acouch:nvd3-recline/vendor/lodash/dist/lodash.js //
// This file is in bare mode and is not in its own closure. //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
/** // 1
* @license // 2
* Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/> // 3
* Build: `lodash modern -o ./dist/lodash.js` // 4
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> // 5
* Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE> // 6
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // 7
* Available under MIT license <http://lodash.com/license> // 8
*/ // 9
;(function() { // 10
// 11
/** Used as a safe reference for `undefined` in pre ES5 environments */ // 12
var undefined; // 13
// 14
/** Used to pool arrays and objects used internally */ // 15
var arrayPool = [], // 16
objectPool = []; // 17
// 18
/** Used to generate unique IDs */ // 19
var idCounter = 0; // 20
// 21
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ // 22
var keyPrefix = +new Date + ''; // 23
// 24
/** Used as the size when optimizations are enabled for large arrays */ // 25
var largeArraySize = 75; // 26
// 27
/** Used as the max size of the `arrayPool` and `objectPool` */ // 28
var maxPoolSize = 40; // 29
// 30
/** Used to detect and test whitespace */ // 31
var whitespace = ( // 32
// whitespace // 33
' \t\x0B\f\xA0\ufeff' + // 34
// 35
// line terminators // 36
'\n\r\u2028\u2029' + // 37
// 38
// unicode category "Zs" space separators // 39
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' // 40
); // 41
// 42
/** Used to match empty string literals in compiled template source */ // 43
var reEmptyStringLeading = /\b__p \+= '';/g, // 44
reEmptyStringMiddle = /\b(__p \+=) '' \+/g, // 45
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; // 46
// 47
/** // 48
* Used to match ES6 template delimiters // 49
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals // 50
*/ // 51
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; // 52
// 53
/** Used to match regexp flags from their coerced string values */ // 54
var reFlags = /\w*$/; // 55
// 56
/** Used to detected named functions */ // 57
var reFuncName = /^\s*function[ \n\r\t]+\w/; // 58
// 59
/** Used to match "interpolate" template delimiters */ // 60
var reInterpolate = /<%=([\s\S]+?)%>/g; // 61
// 62
/** Used to match leading whitespace and zeros to be removed */ // 63
var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); // 64
// 65
/** Used to ensure capturing order of template delimiters */ // 66
var reNoMatch = /($^)/; // 67
// 68
/** Used to detect functions containing a `this` reference */ // 69
var reThis = /\bthis\b/; // 70
// 71
/** Used to match unescaped characters in compiled string literals */ // 72
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; // 73
// 74
/** Used to assign default `context` object properties */ // 75
var contextProps = [ // 76
'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', // 77
'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', // 78
'parseInt', 'setTimeout' // 79
]; // 80
// 81
/** Used to make template sourceURLs easier to identify */ // 82
var templateCounter = 0; // 83
// 84
/** `Object#toString` result shortcuts */ // 85
var argsClass = '[object Arguments]', // 86
arrayClass = '[object Array]', // 87
boolClass = '[object Boolean]', // 88
dateClass = '[object Date]', // 89
funcClass = '[object Function]', // 90
numberClass = '[object Number]', // 91
objectClass = '[object Object]', // 92
regexpClass = '[object RegExp]', // 93
stringClass = '[object String]'; // 94
// 95
/** Used to identify object classifications that `_.clone` supports */ // 96
var cloneableClasses = {}; // 97
cloneableClasses[funcClass] = false; // 98
cloneableClasses[argsClass] = cloneableClasses[arrayClass] = // 99
cloneableClasses[boolClass] = cloneableClasses[dateClass] = // 100
cloneableClasses[numberClass] = cloneableClasses[objectClass] = // 101
cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; // 102
// 103
/** Used as an internal `_.debounce` options object */ // 104
var debounceOptions = { // 105
'leading': false, // 106
'maxWait': 0, // 107
'trailing': false // 108
}; // 109
// 110
/** Used as the property descriptor for `__bindData__` */ // 111
var descriptor = { // 112
'configurable': false, // 113
'enumerable': false, // 114
'value': null, // 115
'writable': false // 116
}; // 117
// 118
/** Used to determine if values are of the language type Object */ // 119
var objectTypes = { // 120
'boolean': false, // 121
'function': true, // 122
'object': true, // 123
'number': false, // 124
'string': false, // 125
'undefined': false // 126
}; // 127
// 128
/** Used to escape characters for inclusion in compiled string literals */ // 129
var stringEscapes = { // 130
'\\': '\\', // 131
"'": "'", // 132
'\n': 'n', // 133
'\r': 'r', // 134
'\t': 't', // 135
'\u2028': 'u2028', // 136
'\u2029': 'u2029' // 137
}; // 138
// 139
/** Used as a reference to the global object */ // 140
var root = (objectTypes[typeof window] && window) || this; // 141
// 142
/** Detect free variable `exports` */ // 143
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; // 144
// 145
/** Detect free variable `module` */ // 146
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; // 147
// 148
/** Detect the popular CommonJS extension `module.exports` */ // 149
var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; // 150
// 151
/** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ // 152
var freeGlobal = objectTypes[typeof global] && global; // 153
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { // 154
root = freeGlobal; // 155
} // 156
// 157
/*--------------------------------------------------------------------------*/ // 158
// 159
/** // 160
* The base implementation of `_.indexOf` without support for binary searches // 161
* or `fromIndex` constraints. // 162
* // 163
* @private // 164
* @param {Array} array The array to search. // 165
* @param {*} value The value to search for. // 166
* @param {number} [fromIndex=0] The index to search from. // 167
* @returns {number} Returns the index of the matched value or `-1`. // 168
*/ // 169
function baseIndexOf(array, value, fromIndex) { // 170
var index = (fromIndex || 0) - 1, // 171
length = array ? array.length : 0; // 172
// 173
while (++index < length) { // 174
if (array[index] === value) { // 175
return index; // 176
} // 177
} // 178
return -1; // 179
} // 180
// 181
/** // 182
* An implementation of `_.contains` for cache objects that mimics the return // 183
* signature of `_.indexOf` by returning `0` if the value is found, else `-1`. // 184
* // 185
* @private // 186
* @param {Object} cache The cache object to inspect. // 187
* @param {*} value The value to search for. // 188
* @returns {number} Returns `0` if `value` is found, else `-1`. // 189
*/ // 190
function cacheIndexOf(cache, value) { // 191
var type = typeof value; // 192
cache = cache.cache; // 193
// 194
if (type == 'boolean' || value == null) { // 195
return cache[value] ? 0 : -1; // 196
} // 197
if (type != 'number' && type != 'string') { // 198
type = 'object'; // 199
} // 200
var key = type == 'number' ? value : keyPrefix + value; // 201
cache = (cache = cache[type]) && cache[key]; // 202
// 203
return type == 'object' // 204
? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) // 205
: (cache ? 0 : -1); // 206
} // 207
// 208
/** // 209
* Adds a given value to the corresponding cache object. // 210
* // 211
* @private // 212
* @param {*} value The value to add to the cache. // 213
*/ // 214
function cachePush(value) { // 215
var cache = this.cache, // 216
type = typeof value; // 217
// 218
if (type == 'boolean' || value == null) { // 219
cache[value] = true; // 220
} else { // 221
if (type != 'number' && type != 'string') { // 222
type = 'object'; // 223
} // 224
var key = type == 'number' ? value : keyPrefix + value, // 225
typeCache = cache[type] || (cache[type] = {}); // 226
// 227
if (type == 'object') { // 228
(typeCache[key] || (typeCache[key] = [])).push(value); // 229
} else { // 230
typeCache[key] = true; // 231
} // 232
} // 233
} // 234
// 235
/** // 236
* Used by `_.max` and `_.min` as the default callback when a given // 237
* collection is a string value. // 238
* // 239
* @private // 240
* @param {string} value The character to inspect. // 241
* @returns {number} Returns the code unit of given character. // 242
*/ // 243
function charAtCallback(value) { // 244
return value.charCodeAt(0); // 245
} // 246
// 247
/** // 248
* Used by `sortBy` to compare transformed `collection` elements, stable sorting // 249
* them in ascending order. // 250
* // 251
* @private // 252
* @param {Object} a The object to compare to `b`. // 253
* @param {Object} b The object to compare to `a`. // 254
* @returns {number} Returns the sort order indicator of `1` or `-1`. // 255
*/ // 256
function compareAscending(a, b) { // 257
var ac = a.criteria, // 258
bc = b.criteria, // 259
index = -1, // 260
length = ac.length; // 261
// 262
while (++index < length) { // 263
var value = ac[index], // 264
other = bc[index]; // 265
// 266
if (value !== other) { // 267
if (value > other || typeof value == 'undefined') { // 268
return 1; // 269
} // 270
if (value < other || typeof other == 'undefined') { // 271
return -1; // 272
} // 273
} // 274
} // 275
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // 276
// that causes it, under certain circumstances, to return the same value for // 277
// `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247 // 278
// // 279
// This also ensures a stable sort in V8 and other engines. // 280
// See http://code.google.com/p/v8/issues/detail?id=90 // 281
return a.index - b.index; // 282
} // 283
// 284
/** // 285
* Creates a cache object to optimize linear searches of large arrays. // 286
* // 287
* @private // 288
* @param {Array} [array=[]] The array to search. // 289
* @returns {null|Object} Returns the cache object or `null` if caching should not be used. // 290
*/ // 291
function createCache(array) { // 292
var index = -1, // 293
length = array.length, // 294
first = array[0], // 295
mid = array[(length / 2) | 0], // 296
last = array[length - 1]; // 297
// 298
if (first && typeof first == 'object' && // 299
mid && typeof mid == 'object' && last && typeof last == 'object') { // 300
return false; // 301
} // 302
var cache = getObject(); // 303
cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; // 304
// 305
var result = getObject(); // 306
result.array = array; // 307
result.cache = cache; // 308
result.push = cachePush; // 309
// 310
while (++index < length) { // 311
result.push(array[index]); // 312
} // 313
return result; // 314
} // 315
// 316
/** // 317
* Used by `template` to escape characters for inclusion in compiled // 318
* string literals. // 319
* // 320
* @private // 321
* @param {string} match The matched character to escape. // 322
* @returns {string} Returns the escaped character. // 323
*/ // 324
function escapeStringChar(match) { // 325
return '\\' + stringEscapes[match]; // 326
} // 327
// 328
/** // 329
* Gets an array from the array pool or creates a new one if the pool is empty. // 330
* // 331
* @private // 332
* @returns {Array} The array from the pool. // 333
*/ // 334
function getArray() { // 335
return arrayPool.pop() || []; // 336
} // 337
// 338
/** // 339
* Gets an object from the object pool or creates a new one if the pool is empty. // 340
* // 341
* @private // 342
* @returns {Object} The object from the pool. // 343
*/ // 344
function getObject() { // 345
return objectPool.pop() || { // 346
'array': null, // 347
'cache': null, // 348
'criteria': null, // 349
'false': false, // 350
'index': 0, // 351
'null': false, // 352
'number': null, // 353
'object': null, // 354
'push': null, // 355
'string': null, // 356
'true': false, // 357
'undefined': false, // 358
'value': null // 359
}; // 360
} // 361
// 362
/** // 363
* Releases the given array back to the array pool. // 364
* // 365
* @private // 366
* @param {Array} [array] The array to release. // 367
*/ // 368
function releaseArray(array) { // 369
array.length = 0; // 370
if (arrayPool.length < maxPoolSize) { // 371
arrayPool.push(array); // 372
} // 373
} // 374
// 375
/** // 376
* Releases the given object back to the object pool. // 377
* // 378
* @private // 379
* @param {Object} [object] The object to release. // 380
*/ // 381
function releaseObject(object) { // 382
var cache = object.cache; // 383
if (cache) { // 384
releaseObject(cache); // 385
} // 386
object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null;
if (objectPool.length < maxPoolSize) { // 388
objectPool.push(object); // 389
} // 390
} // 391
// 392
/** // 393
* Slices the `collection` from the `start` index up to, but not including, // 394
* the `end` index. // 395
* // 396
* Note: This function is used instead of `Array#slice` to support node lists // 397
* in IE < 9 and to ensure dense arrays are returned. // 398
* // 399
* @private // 400
* @param {Array|Object|string} collection The collection to slice. // 401
* @param {number} start The start index. // 402
* @param {number} end The end index. // 403
* @returns {Array} Returns the new array. // 404
*/ // 405
function slice(array, start, end) { // 406
start || (start = 0); // 407
if (typeof end == 'undefined') { // 408
end = array ? array.length : 0; // 409
} // 410
var index = -1, // 411
length = end - start || 0, // 412
result = Array(length < 0 ? 0 : length); // 413
// 414
while (++index < length) { // 415
result[index] = array[start + index]; // 416
} // 417
return result; // 418
} // 419
// 420
/*--------------------------------------------------------------------------*/ // 421
// 422
/** // 423
* Create a new `lodash` function using the given context object. // 424
* // 425
* @static // 426
* @memberOf _ // 427
* @category Utilities // 428
* @param {Object} [context=root] The context object. // 429
* @returns {Function} Returns the `lodash` function. // 430
*/ // 431
function runInContext(context) { // 432
// Avoid issues with some ES3 environments that attempt to use values, named // 433
// after built-in constructors like `Object`, for the creation of literals. // 434
// ES5 clears this up by stating that literals must use built-in constructors. // 435
// See http://es5.github.io/#x11.1.5. // 436
context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; // 437
// 438
/** Native constructor references */ // 439
var Array = context.Array, // 440
Boolean = context.Boolean, // 441
Date = context.Date, // 442
Function = context.Function, // 443
Math = context.Math, // 444
Number = context.Number, // 445
Object = context.Object, // 446
RegExp = context.RegExp, // 447
String = context.String, // 448
TypeError = context.TypeError; // 449
// 450
/** // 451
* Used for `Array` method references. // 452
* // 453
* Normally `Array.prototype` would suffice, however, using an array literal // 454
* avoids issues in Narwhal. // 455
*/ // 456
var arrayRef = []; // 457
// 458
/** Used for native method references */ // 459
var objectProto = Object.prototype; // 460
// 461
/** Used to restore the original `_` reference in `noConflict` */ // 462
var oldDash = context._; // 463
// 464
/** Used to resolve the internal [[Class]] of values */ // 465
var toString = objectProto.toString; // 466
// 467
/** Used to detect if a method is native */ // 468
var reNative = RegExp('^' + // 469
String(toString) // 470
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // 471
.replace(/toString| for [^\]]+/g, '.*?') + '$' // 472
); // 473
// 474
/** Native method shortcuts */ // 475
var ceil = Math.ceil, // 476
clearTimeout = context.clearTimeout, // 477
floor = Math.floor, // 478
fnToString = Function.prototype.toString, // 479
getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, // 480
hasOwnProperty = objectProto.hasOwnProperty, // 481
push = arrayRef.push, // 482
setTimeout = context.setTimeout, // 483
splice = arrayRef.splice, // 484
unshift = arrayRef.unshift; // 485
// 486
/** Used to set meta data on functions */ // 487
var defineProperty = (function() { // 488
// IE 8 only accepts DOM elements // 489
try { // 490
var o = {}, // 491
func = isNative(func = Object.defineProperty) && func, // 492
result = func(o, o, o) && func; // 493
} catch(e) { } // 494
return result; // 495
}()); // 496
// 497
/* Native method shortcuts for methods with the same name as other `lodash` methods */ // 498
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, // 499
nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, // 500
nativeIsFinite = context.isFinite, // 501
nativeIsNaN = context.isNaN, // 502
nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, // 503
nativeMax = Math.max, // 504
nativeMin = Math.min, // 505
nativeParseInt = context.parseInt, // 506
nativeRandom = Math.random; // 507
// 508
/** Used to lookup a built-in constructor by [[Class]] */ // 509
var ctorByClass = {}; // 510
ctorByClass[arrayClass] = Array; // 511
ctorByClass[boolClass] = Boolean; // 512
ctorByClass[dateClass] = Date; // 513
ctorByClass[funcClass] = Function; // 514
ctorByClass[objectClass] = Object; // 515
ctorByClass[numberClass] = Number; // 516
ctorByClass[regexpClass] = RegExp; // 517
ctorByClass[stringClass] = String; // 518
// 519
/*--------------------------------------------------------------------------*/ // 520
// 521
/** // 522
* Creates a `lodash` object which wraps the given value to enable intuitive // 523
* method chaining. // 524
* // 525
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods: // 526
* `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, // 527
* and `unshift` // 528
* // 529
* Chaining is supported in custom builds as long as the `value` method is // 530
* implicitly or explicitly included in the build. // 531
* // 532
* The chainable wrapper functions are: // 533
* `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, // 534
* `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, // 535
* `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, // 536
* `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, // 537
* `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, // 538
* `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, // 539
* `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, // 540
* `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, // 541
* `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, // 542
* `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, // 543
* and `zip` // 544
* // 545
* The non-chainable wrapper functions are: // 546
* `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, // 547
* `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, // 548
* `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, // 549
* `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, // 550
* `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, // 551
* `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, // 552
* `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, // 553
* `template`, `unescape`, `uniqueId`, and `value` // 554
* // 555
* The wrapper functions `first` and `last` return wrapped values when `n` is // 556
* provided, otherwise they return unwrapped values. // 557
* // 558
* Explicit chaining can be enabled by using the `_.chain` method. // 559
* // 560
* @name _ // 561
* @constructor // 562
* @category Chaining // 563
* @param {*} value The value to wrap in a `lodash` instance. // 564
* @returns {Object} Returns a `lodash` instance. // 565
* @example // 566
* // 567
* var wrapped = _([1, 2, 3]); // 568
* // 569
* // returns an unwrapped value // 570
* wrapped.reduce(function(sum, num) { // 571
* return sum + num; // 572
* }); // 573
* // => 6 // 574
* // 575
* // returns a wrapped value // 576
* var squares = wrapped.map(function(num) { // 577
* return num * num; // 578
* }); // 579
* // 580
* _.isArray(squares); // 581
* // => false // 582
* // 583
* _.isArray(squares.value()); // 584
* // => true // 585
*/ // 586
function lodash(value) { // 587
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor // 588
return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__')) // 589
? value // 590
: new lodashWrapper(value); // 591
} // 592
// 593
/** // 594
* A fast path for creating `lodash` wrapper objects. // 595
* // 596
* @private // 597
* @param {*} value The value to wrap in a `lodash` instance. // 598
* @param {boolean} chainAll A flag to enable chaining for all methods // 599
* @returns {Object} Returns a `lodash` instance. // 600
*/ // 601
function lodashWrapper(value, chainAll) { // 602
this.__chain__ = !!chainAll; // 603
this.__wrapped__ = value; // 604
} // 605
// ensure `new lodashWrapper` is an instance of `lodash` // 606
lodashWrapper.prototype = lodash.prototype; // 607
// 608
/** // 609
* An object used to flag environments features. // 610
* // 611
* @static // 612
* @memberOf _ // 613
* @type Object // 614
*/ // 615
var support = lodash.support = {}; // 616
// 617
/** // 618
* Detect if functions can be decompiled by `Function#toString` // 619
* (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). // 620
* // 621
* @memberOf _.support // 622
* @type boolean // 623
*/ // 624
support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext); // 625
// 626
/** // 627
* Detect if `Function#name` is supported (all but IE). // 628
* // 629
* @memberOf _.support // 630
* @type boolean // 631
*/ // 632
support.funcNames = typeof Function.name == 'string'; // 633
// 634
/** // 635
* By default, the template delimiters used by Lo-Dash are similar to those in // 636
* embedded Ruby (ERB). Change the following template settings to use alternative // 637
* delimiters. // 638
* // 639
* @static // 640
* @memberOf _ // 641
* @type Object // 642
*/ // 643
lodash.templateSettings = { // 644
// 645
/** // 646
* Used to detect `data` property values to be HTML-escaped. // 647
* // 648
* @memberOf _.templateSettings // 649
* @type RegExp // 650
*/ // 651
'escape': /<%-([\s\S]+?)%>/g, // 652
// 653
/** // 654
* Used to detect code to be evaluated. // 655
* // 656
* @memberOf _.templateSettings // 657
* @type RegExp // 658
*/ // 659
'evaluate': /<%([\s\S]+?)%>/g, // 660
// 661
/** // 662
* Used to detect `data` property values to inject. // 663
* // 664
* @memberOf _.templateSettings // 665
* @type RegExp // 666
*/ // 667
'interpolate': reInterpolate, // 668
// 669
/** // 670
* Used to reference the data object in the template text. // 671
* // 672
* @memberOf _.templateSettings // 673
* @type string // 674
*/ // 675
'variable': '', // 676
// 677
/** // 678
* Used to import variables into the compiled template. // 679
* // 680
* @memberOf _.templateSettings // 681
* @type Object // 682
*/ // 683
'imports': { // 684
// 685
/** // 686
* A reference to the `lodash` function. // 687
* // 688
* @memberOf _.templateSettings.imports // 689
* @type Function // 690
*/ // 691
'_': lodash // 692
} // 693
}; // 694
// 695
/*--------------------------------------------------------------------------*/ // 696
// 697
/** // 698
* The base implementation of `_.bind` that creates the bound function and // 699
* sets its meta data. // 700
* // 701
* @private // 702
* @param {Array} bindData The bind data array. // 703
* @returns {Function} Returns the new bound function. // 704
*/ // 705
function baseBind(bindData) { // 706
var func = bindData[0], // 707
partialArgs = bindData[2], // 708
thisArg = bindData[4]; // 709
// 710
function bound() { // 711
// `Function#bind` spec // 712
// http://es5.github.io/#x15.3.4.5 // 713
if (partialArgs) { // 714
// avoid `arguments` object deoptimizations by using `slice` instead // 715
// of `Array.prototype.slice.call` and not assigning `arguments` to a // 716
// variable as a ternary expression // 717
var args = slice(partialArgs); // 718
push.apply(args, arguments); // 719
} // 720
// mimic the constructor's `return` behavior // 721
// http://es5.github.io/#x13.2.2 // 722
if (this instanceof bound) { // 723
// ensure `new bound` is an instance of `func` // 724
var thisBinding = baseCreate(func.prototype), // 725
result = func.apply(thisBinding, args || arguments); // 726
return isObject(result) ? result : thisBinding; // 727
} // 728
return func.apply(thisArg, args || arguments); // 729
} // 730
setBindData(bound, bindData); // 731
return bound; // 732
} // 733
// 734
/** // 735
* The base implementation of `_.clone` without argument juggling or support // 736
* for `thisArg` binding. // 737
* // 738
* @private // 739
* @param {*} value The value to clone. // 740
* @param {boolean} [isDeep=false] Specify a deep clone. // 741
* @param {Function} [callback] The function to customize cloning values. // 742
* @param {Array} [stackA=[]] Tracks traversed source objects. // 743
* @param {Array} [stackB=[]] Associates clones with source counterparts. // 744
* @returns {*} Returns the cloned value. // 745
*/ // 746
function baseClone(value, isDeep, callback, stackA, stackB) { // 747
if (callback) { // 748
var result = callback(value); // 749
if (typeof result != 'undefined') { // 750
return result; // 751
} // 752
} // 753
// inspect [[Class]] // 754
var isObj = isObject(value); // 755
if (isObj) { // 756
var className = toString.call(value); // 757
if (!cloneableClasses[className]) { // 758
return value; // 759
} // 760
var ctor = ctorByClass[className]; // 761
switch (className) { // 762
case boolClass: // 763
case dateClass: // 764
return new ctor(+value); // 765
// 766
case numberClass: // 767
case stringClass: // 768
return new ctor(value); // 769
// 770
case regexpClass: // 771
result = ctor(value.source, reFlags.exec(value)); // 772
result.lastIndex = value.lastIndex; // 773
return result; // 774
} // 775
} else { // 776
return value; // 777
} // 778
var isArr = isArray(value); // 779
if (isDeep) { // 780
// check for circular references and return corresponding clone // 781
var initedStack = !stackA; // 782
stackA || (stackA = getArray()); // 783
stackB || (stackB = getArray()); // 784
// 785
var length = stackA.length; // 786
while (length--) { // 787
if (stackA[length] == value) { // 788
return stackB[length]; // 789
} // 790
} // 791
result = isArr ? ctor(value.length) : {}; // 792
} // 793
else { // 794
result = isArr ? slice(value) : assign({}, value); // 795
} // 796
// add array properties assigned by `RegExp#exec` // 797
if (isArr) { // 798
if (hasOwnProperty.call(value, 'index')) { // 799
result.index = value.index; // 800
} // 801
if (hasOwnProperty.call(value, 'input')) { // 802
result.input = value.input; // 803
} // 804
} // 805
// exit for shallow clone // 806
if (!isDeep) { // 807
return result; // 808
} // 809
// add the source value to the stack of traversed objects // 810
// and associate it with its clone // 811
stackA.push(value); // 812
stackB.push(result); // 813
// 814
// recursively populate clone (susceptible to call stack limits) // 815
(isArr ? forEach : forOwn)(value, function(objValue, key) { // 816
result[key] = baseClone(objValue, isDeep, callback, stackA, stackB); // 817
}); // 818
// 819
if (initedStack) { // 820
releaseArray(stackA); // 821
releaseArray(stackB); // 822
} // 823
return result; // 824
} // 825
// 826
/** // 827
* The base implementation of `_.create` without support for assigning // 828
* properties to the created object. // 829
* // 830
* @private // 831
* @param {Object} prototype The object to inherit from. // 832
* @returns {Object} Returns the new object. // 833
*/ // 834
function baseCreate(prototype, properties) { // 835
return isObject(prototype) ? nativeCreate(prototype) : {}; // 836
} // 837
// fallback for browsers without `Object.create` // 838
if (!nativeCreate) { // 839
baseCreate = (function() { // 840
function Object() {} // 841
return function(prototype) { // 842
if (isObject(prototype)) { // 843
Object.prototype = prototype; // 844
var result = new Object; // 845
Object.prototype = null; // 846
} // 847
return result || context.Object(); // 848
}; // 849
}()); // 850
} // 851
// 852
/** // 853
* The base implementation of `_.createCallback` without support for creating // 854
* "_.pluck" or "_.where" style callbacks. // 855
* // 856
* @private // 857
* @param {*} [func=identity] The value to convert to a callback. // 858
* @param {*} [thisArg] The `this` binding of the created callback. // 859
* @param {number} [argCount] The number of arguments the callback accepts. // 860
* @returns {Function} Returns a callback function. // 861
*/ // 862
function baseCreateCallback(func, thisArg, argCount) { // 863
if (typeof func != 'function') { // 864
return identity; // 865
} // 866
// exit early for no `thisArg` or already bound by `Function#bind` // 867
if (typeof thisArg == 'undefined' || !('prototype' in func)) { // 868
return func; // 869
} // 870
var bindData = func.__bindData__; // 871
if (typeof bindData == 'undefined') { // 872
if (support.funcNames) { // 873
bindData = !func.name; // 874
} // 875
bindData = bindData || !support.funcDecomp; // 876
if (!bindData) { // 877
var source = fnToString.call(func); // 878
if (!support.funcNames) { // 879
bindData = !reFuncName.test(source); // 880
} // 881
if (!bindData) { // 882
// checks if `func` references the `this` keyword and stores the result // 883
bindData = reThis.test(source); // 884
setBindData(func, bindData); // 885
} // 886
} // 887
} // 888
// exit early if there are no `this` references or `func` is bound // 889
if (bindData === false || (bindData !== true && bindData[1] & 1)) { // 890
return func; // 891
} // 892
switch (argCount) { // 893
case 1: return function(value) { // 894
return func.call(thisArg, value); // 895
}; // 896
case 2: return function(a, b) { // 897
return func.call(thisArg, a, b); // 898
}; // 899
case 3: return function(value, index, collection) { // 900
return func.call(thisArg, value, index, collection); // 901
}; // 902
case 4: return function(accumulator, value, index, collection) { // 903
return func.call(thisArg, accumulator, value, index, collection); // 904
}; // 905
} // 906
return bind(func, thisArg); // 907
} // 908
// 909
/** // 910
* The base implementation of `createWrapper` that creates the wrapper and // 911
* sets its meta data. // 912
* // 913
* @private // 914
* @param {Array} bindData The bind data array. // 915
* @returns {Function} Returns the new function. // 916
*/ // 917
function baseCreateWrapper(bindData) { // 918
var func = bindData[0], // 919
bitmask = bindData[1], // 920
partialArgs = bindData[2], // 921
partialRightArgs = bindData[3], // 922
thisArg = bindData[4], // 923
arity = bindData[5]; // 924
// 925
var isBind = bitmask & 1, // 926
isBindKey = bitmask & 2, // 927
isCurry = bitmask & 4, // 928
isCurryBound = bitmask & 8, // 929
key = func; // 930
// 931
function bound() { // 932
var thisBinding = isBind ? thisArg : this; // 933
if (partialArgs) { // 934
var args = slice(partialArgs); // 935
push.apply(args, arguments); // 936
} // 937
if (partialRightArgs || isCurry) { // 938
args || (args = slice(arguments)); // 939
if (partialRightArgs) { // 940
push.apply(args, partialRightArgs); // 941
} // 942
if (isCurry && args.length < arity) { // 943
bitmask |= 16 & ~32; // 944
return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]); // 945
} // 946
} // 947
args || (args = arguments); // 948
if (isBindKey) { // 949
func = thisBinding[key]; // 950
} // 951
if (this instanceof bound) { // 952
thisBinding = baseCreate(func.prototype); // 953
var result = func.apply(thisBinding, args); // 954
return isObject(result) ? result : thisBinding; // 955
} // 956
return func.apply(thisBinding, args); // 957
} // 958
setBindData(bound, bindData); // 959
return bound; // 960
} // 961
// 962
/** // 963
* The base implementation of `_.difference` that accepts a single array // 964
* of values to exclude. // 965
* // 966
* @private // 967
* @param {Array} array The array to process. // 968
* @param {Array} [values] The array of values to exclude. // 969
* @returns {Array} Returns a new array of filtered values. // 970
*/ // 971
function baseDifference(array, values) { // 972
var index = -1, // 973
indexOf = getIndexOf(), // 974
length = array ? array.length : 0, // 975
isLarge = length >= largeArraySize && indexOf === baseIndexOf, // 976
result = []; // 977
// 978
if (isLarge) { // 979
var cache = createCache(values); // 980
if (cache) { // 981
indexOf = cacheIndexOf; // 982
values = cache; // 983
} else { // 984
isLarge = false; // 985
} // 986
} // 987
while (++index < length) { // 988
var value = array[index]; // 989
if (indexOf(values, value) < 0) { // 990
result.push(value); // 991
} // 992
} // 993
if (isLarge) { // 994
releaseObject(values); // 995
} // 996
return result; // 997
} // 998
// 999
/** // 1000
* The base implementation of `_.flatten` without support for callback // 1001
* shorthands or `thisArg` binding. // 1002
* // 1003
* @private // 1004
* @param {Array} array The array to flatten. // 1005
* @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. // 1006
* @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects. // 1007
* @param {number} [fromIndex=0] The index to start from. // 1008
* @returns {Array} Returns a new flattened array. // 1009
*/ // 1010
function baseFlatten(array, isShallow, isStrict, fromIndex) { // 1011
var index = (fromIndex || 0) - 1, // 1012
length = array ? array.length : 0, // 1013
result = []; // 1014
// 1015
while (++index < length) { // 1016
var value = array[index]; // 1017
// 1018
if (value && typeof value == 'object' && typeof value.length == 'number' // 1019
&& (isArray(value) || isArguments(value))) { // 1020
// recursively flatten arrays (susceptible to call stack limits) // 1021
if (!isShallow) { // 1022
value = baseFlatten(value, isShallow, isStrict); // 1023
} // 1024
var valIndex = -1, // 1025
valLength = value.length, // 1026
resIndex = result.length; // 1027
// 1028
result.length += valLength; // 1029
while (++valIndex < valLength) { // 1030
result[resIndex++] = value[valIndex]; // 1031
} // 1032
} else if (!isStrict) { // 1033
result.push(value); // 1034
} // 1035
} // 1036
return result; // 1037
} // 1038
// 1039
/** // 1040
* The base implementation of `_.isEqual`, without support for `thisArg` binding, // 1041
* that allows partial "_.where" style comparisons. // 1042
* // 1043
* @private // 1044
* @param {*} a The value to compare. // 1045
* @param {*} b The other value to compare. // 1046
* @param {Function} [callback] The function to customize comparing values. // 1047
* @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. // 1048
* @param {Array} [stackA=[]] Tracks traversed `a` objects. // 1049
* @param {Array} [stackB=[]] Tracks traversed `b` objects. // 1050
* @returns {boolean} Returns `true` if the values are equivalent, else `false`. // 1051
*/ // 1052
function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { // 1053
// used to indicate that when comparing objects, `a` has at least the properties of `b` // 1054
if (callback) { // 1055
var result = callback(a, b); // 1056
if (typeof result != 'undefined') { // 1057
return !!result; // 1058
} // 1059
} // 1060
// exit early for identical values // 1061
if (a === b) { // 1062
// treat `+0` vs. `-0` as not equal // 1063
return a !== 0 || (1 / a == 1 / b); // 1064
} // 1065
var type = typeof a, // 1066
otherType = typeof b; // 1067
// 1068
// exit early for unlike primitive values // 1069
if (a === a && // 1070
!(a && objectTypes[type]) && // 1071
!(b && objectTypes[otherType])) { // 1072
return false; // 1073
} // 1074
// exit early for `null` and `undefined` avoiding ES3's Function#call behavior // 1075
// http://es5.github.io/#x15.3.4.4 // 1076
if (a == null || b == null) { // 1077
return a === b; // 1078
} // 1079
// compare [[Class]] names // 1080
var className = toString.call(a), // 1081
otherClass = toString.call(b); // 1082
// 1083
if (className == argsClass) { // 1084
className = objectClass; // 1085
} // 1086
if (otherClass == argsClass) { // 1087
otherClass = objectClass; // 1088
} // 1089
if (className != otherClass) { // 1090
return false; // 1091
} // 1092
switch (className) { // 1093
case boolClass: // 1094
case dateClass: // 1095
// coerce dates and booleans to numbers, dates to milliseconds and booleans // 1096
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal // 1097
return +a == +b; // 1098
// 1099
case numberClass: // 1100
// treat `NaN` vs. `NaN` as equal // 1101
return (a != +a) // 1102
? b != +b // 1103
// but treat `+0` vs. `-0` as not equal // 1104
: (a == 0 ? (1 / a == 1 / b) : a == +b); // 1105
// 1106
case regexpClass: // 1107
case stringClass: // 1108
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4) // 1109
// treat string primitives and their corresponding object instances as equal // 1110
return a == String(b); // 1111
} // 1112
var isArr = className == arrayClass; // 1113
if (!isArr) { // 1114
// unwrap any `lodash` wrapped values // 1115
var aWrapped = hasOwnProperty.call(a, '__wrapped__'), // 1116
bWrapped = hasOwnProperty.call(b, '__wrapped__'); // 1117
// 1118
if (aWrapped || bWrapped) { // 1119
return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB);
} // 1121
// exit for functions and DOM nodes // 1122
if (className != objectClass) { // 1123
return false; // 1124
} // 1125
// in older versions of Opera, `arguments` objects have `Array` constructors // 1126
var ctorA = a.constructor, // 1127
ctorB = b.constructor; // 1128
// 1129
// non `Object` object instances with different constructors are not equal // 1130
if (ctorA != ctorB && // 1131
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && // 1132
('constructor' in a && 'constructor' in b) // 1133
) { // 1134
return false; // 1135
} // 1136
} // 1137
// assume cyclic structures are equal // 1138
// the algorithm for detecting cyclic structures is adapted from ES 5.1 // 1139
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) // 1140
var initedStack = !stackA; // 1141
stackA || (stackA = getArray()); // 1142
stackB || (stackB = getArray()); // 1143
// 1144
var length = stackA.length; // 1145
while (length--) { // 1146
if (stackA[length] == a) { // 1147
return stackB[length] == b; // 1148
} // 1149
} // 1150
var size = 0; // 1151
result = true; // 1152
// 1153
// add `a` and `b` to the stack of traversed objects // 1154
stackA.push(a); // 1155
stackB.push(b); // 1156
// 1157
// recursively compare objects and arrays (susceptible to call stack limits) // 1158
if (isArr) { // 1159
// compare lengths to determine if a deep comparison is necessary // 1160
length = a.length; // 1161
size = b.length; // 1162
result = size == length; // 1163
// 1164
if (result || isWhere) { // 1165
// deep compare the contents, ignoring non-numeric properties // 1166
while (size--) { // 1167
var index = length, // 1168
value = b[size]; // 1169
// 1170
if (isWhere) { // 1171
while (index--) { // 1172
if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) { // 1173
break; // 1174
} // 1175
} // 1176
} else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) { // 1177
break; // 1178
} // 1179
} // 1180
} // 1181
} // 1182
else { // 1183
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // 1184
// which, in this case, is more costly // 1185
forIn(b, function(value, key, b) { // 1186
if (hasOwnProperty.call(b, key)) { // 1187
// count the number of properties. // 1188
size++; // 1189
// deep compare each property value. // 1190
return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB));
} // 1192
}); // 1193
// 1194
if (result && !isWhere) { // 1195
// ensure both objects have the same number of properties // 1196
forIn(a, function(value, key, a) { // 1197
if (hasOwnProperty.call(a, key)) { // 1198
// `size` will be `-1` if `a` has more properties than `b` // 1199
return (result = --size > -1); // 1200
} // 1201
}); // 1202
} // 1203
} // 1204
stackA.pop(); // 1205
stackB.pop(); // 1206
// 1207
if (initedStack) { // 1208
releaseArray(stackA); // 1209
releaseArray(stackB); // 1210
} // 1211
return result; // 1212
} // 1213
// 1214
/** // 1215
* The base implementation of `_.merge` without argument juggling or support // 1216
* for `thisArg` binding. // 1217
* // 1218
* @private // 1219
* @param {Object} object The destination object. // 1220
* @param {Object} source The source object. // 1221
* @param {Function} [callback] The function to customize merging properties. // 1222
* @param {Array} [stackA=[]] Tracks traversed source objects. // 1223
* @param {Array} [stackB=[]] Associates values with source counterparts. // 1224
*/ // 1225
function baseMerge(object, source, callback, stackA, stackB) { // 1226
(isArray(source) ? forEach : forOwn)(source, function(source, key) { // 1227
var found, // 1228
isArr, // 1229
result = source, // 1230
value = object[key]; // 1231
// 1232
if (source && ((isArr = isArray(source)) || isPlainObject(source))) { // 1233
// avoid merging previously merged cyclic sources // 1234
var stackLength = stackA.length; // 1235
while (stackLength--) { // 1236
if ((found = stackA[stackLength] == source)) { // 1237
value = stackB[stackLength]; // 1238
break; // 1239
} // 1240
} // 1241
if (!found) { // 1242
var isShallow; // 1243
if (callback) { // 1244
result = callback(value, source); // 1245
if ((isShallow = typeof result != 'undefined')) { // 1246
value = result; // 1247
} // 1248
} // 1249
if (!isShallow) { // 1250
value = isArr // 1251
? (isArray(value) ? value : []) // 1252
: (isPlainObject(value) ? value : {}); // 1253
} // 1254
// add `source` and associated `value` to the stack of traversed objects // 1255
stackA.push(source); // 1256
stackB.push(value); // 1257
// 1258
// recursively merge objects and arrays (susceptible to call stack limits) // 1259
if (!isShallow) { // 1260
baseMerge(value, source, callback, stackA, stackB); // 1261
} // 1262
} // 1263
} // 1264
else { // 1265
if (callback) { // 1266
result = callback(value, source); // 1267
if (typeof result == 'undefined') { // 1268
result = source; // 1269
} // 1270
} // 1271
if (typeof result != 'undefined') { // 1272
value = result; // 1273
} // 1274
} // 1275
object[key] = value; // 1276
}); // 1277
} // 1278
// 1279
/** // 1280
* The base implementation of `_.random` without argument juggling or support // 1281
* for returning floating-point numbers. // 1282
* // 1283
* @private // 1284
* @param {number} min The minimum possible value. // 1285
* @param {number} max The maximum possible value. // 1286
* @returns {number} Returns a random number. // 1287
*/ // 1288
function baseRandom(min, max) { // 1289
return min + floor(nativeRandom() * (max - min + 1)); // 1290
} // 1291
// 1292
/** // 1293
* The base implementation of `_.uniq` without support for callback shorthands // 1294
* or `thisArg` binding. // 1295
* // 1296
* @private // 1297
* @param {Array} array The array to process. // 1298
* @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. // 1299
* @param {Function} [callback] The function called per iteration. // 1300
* @returns {Array} Returns a duplicate-value-free array. // 1301
*/ // 1302
function baseUniq(array, isSorted, callback) { // 1303
var index = -1, // 1304
indexOf = getIndexOf(), // 1305
length = array ? array.length : 0, // 1306
result = []; // 1307
// 1308
var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf, // 1309
seen = (callback || isLarge) ? getArray() : result; // 1310
// 1311
if (isLarge) { // 1312
var cache = createCache(seen); // 1313
indexOf = cacheIndexOf; // 1314
seen = cache; // 1315
} // 1316
while (++index < length) { // 1317
var value = array[index], // 1318
computed = callback ? callback(value, index, array) : value; // 1319
// 1320
if (isSorted // 1321
? !index || seen[seen.length - 1] !== computed // 1322
: indexOf(seen, computed) < 0 // 1323
) { // 1324
if (callback || isLarge) { // 1325
seen.push(computed); // 1326
} // 1327
result.push(value); // 1328
} // 1329
} // 1330
if (isLarge) { // 1331
releaseArray(seen.array); // 1332
releaseObject(seen); // 1333
} else if (callback) { // 1334
releaseArray(seen); // 1335
} // 1336
return result; // 1337
} // 1338
// 1339
/** // 1340
* Creates a function that aggregates a collection, creating an object composed // 1341
* of keys generated from the results of running each element of the collection // 1342
* through a callback. The given `setter` function sets the keys and values // 1343
* of the composed object. // 1344
* // 1345
* @private // 1346
* @param {Function} setter The setter function. // 1347
* @returns {Function} Returns the new aggregator function. // 1348
*/ // 1349
function createAggregator(setter) { // 1350
return function(collection, callback, thisArg) { // 1351
var result = {}; // 1352
callback = lodash.createCallback(callback, thisArg, 3); // 1353
// 1354
var index = -1, // 1355
length = collection ? collection.length : 0; // 1356
// 1357
if (typeof length == 'number') { // 1358
while (++index < length) { // 1359
var value = collection[index]; // 1360
setter(result, value, callback(value, index, collection), collection); // 1361
} // 1362
} else { // 1363
forOwn(collection, function(value, key, collection) { // 1364
setter(result, value, callback(value, key, collection), collection); // 1365
}); // 1366
} // 1367
return result; // 1368
}; // 1369
} // 1370
// 1371
/** // 1372
* Creates a function that, when called, either curries or invokes `func` // 1373
* with an optional `this` binding and partially applied arguments. // 1374
* // 1375
* @private // 1376
* @param {Function|string} func The function or method name to reference. // 1377
* @param {number} bitmask The bitmask of method flags to compose. // 1378
* The bitmask may be composed of the following flags: // 1379
* 1 - `_.bind` // 1380
* 2 - `_.bindKey` // 1381
* 4 - `_.curry` // 1382
* 8 - `_.curry` (bound) // 1383
* 16 - `_.partial` // 1384
* 32 - `_.partialRight` // 1385
* @param {Array} [partialArgs] An array of arguments to prepend to those // 1386
* provided to the new function. // 1387
* @param {Array} [partialRightArgs] An array of arguments to append to those // 1388
* provided to the new function. // 1389
* @param {*} [thisArg] The `this` binding of `func`. // 1390
* @param {number} [arity] The arity of `func`. // 1391
* @returns {Function} Returns the new function. // 1392
*/ // 1393
function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) { // 1394
var isBind = bitmask & 1, // 1395
isBindKey = bitmask & 2, // 1396
isCurry = bitmask & 4, // 1397
isCurryBound = bitmask & 8, // 1398
isPartial = bitmask & 16, // 1399
isPartialRight = bitmask & 32; // 1400
// 1401
if (!isBindKey && !isFunction(func)) { // 1402
throw new TypeError; // 1403
} // 1404
if (isPartial && !partialArgs.length) { // 1405
bitmask &= ~16; // 1406
isPartial = partialArgs = false; // 1407
} // 1408
if (isPartialRight && !partialRightArgs.length) { // 1409
bitmask &= ~32; // 1410
isPartialRight = partialRightArgs = false; // 1411
} // 1412
var bindData = func && func.__bindData__; // 1413
if (bindData && bindData !== true) { // 1414
// clone `bindData` // 1415
bindData = slice(bindData); // 1416
if (bindData[2]) { // 1417
bindData[2] = slice(bindData[2]); // 1418
} // 1419
if (bindData[3]) { // 1420
bindData[3] = slice(bindData[3]); // 1421
} // 1422
// set `thisBinding` is not previously bound // 1423
if (isBind && !(bindData[1] & 1)) { // 1424
bindData[4] = thisArg; // 1425
} // 1426
// set if previously bound but not currently (subsequent curried functions) // 1427
if (!isBind && bindData[1] & 1) { // 1428
bitmask |= 8; // 1429
} // 1430
// set curried arity if not yet set // 1431
if (isCurry && !(bindData[1] & 4)) { // 1432
bindData[5] = arity; // 1433
} // 1434
// append partial left arguments // 1435
if (isPartial) { // 1436
push.apply(bindData[2] || (bindData[2] = []), partialArgs); // 1437
} // 1438
// append partial right arguments // 1439
if (isPartialRight) { // 1440
unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs); // 1441
} // 1442
// merge flags // 1443
bindData[1] |= bitmask; // 1444
return createWrapper.apply(null, bindData); // 1445
} // 1446
// fast path for `_.bind` // 1447
var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper; // 1448
return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]); // 1449
} // 1450
// 1451
/** // 1452
* Used by `escape` to convert characters to HTML entities. // 1453
* // 1454
* @private // 1455
* @param {string} match The matched character to escape. // 1456
* @returns {string} Returns the escaped character. // 1457
*/ // 1458
function escapeHtmlChar(match) { // 1459
return htmlEscapes[match]; // 1460
} // 1461
// 1462
/** // 1463
* Gets the appropriate "indexOf" function. If the `_.indexOf` method is // 1464
* customized, this method returns the custom method, otherwise it returns // 1465
* the `baseIndexOf` function. // 1466
* // 1467
* @private // 1468
* @returns {Function} Returns the "indexOf" function. // 1469
*/ // 1470
function getIndexOf() { // 1471
var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; // 1472
return result; // 1473
} // 1474
// 1475
/** // 1476
* Checks if `value` is a native function. // 1477
* // 1478
* @private // 1479
* @param {*} value The value to check. // 1480
* @returns {boolean} Returns `true` if the `value` is a native function, else `false`. // 1481
*/ // 1482
function isNative(value) { // 1483
return typeof value == 'function' && reNative.test(value); // 1484
} // 1485
// 1486
/** // 1487
* Sets `this` binding data on a given function. // 1488
* // 1489
* @private // 1490
* @param {Function} func The function to set data on. // 1491
* @param {Array} value The data array to set. // 1492
*/ // 1493
var setBindData = !defineProperty ? noop : function(func, value) { // 1494
descriptor.value = value; // 1495
defineProperty(func, '__bindData__', descriptor); // 1496
}; // 1497
// 1498
/** // 1499
* A fallback implementation of `isPlainObject` which checks if a given value // 1500
* is an object created by the `Object` constructor, assuming objects created // 1501
* by the `Object` constructor have no inherited enumerable properties and that // 1502
* there are no `Object.prototype` extensions. // 1503
* // 1504
* @private // 1505
* @param {*} value The value to check. // 1506
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`. // 1507
*/ // 1508
function shimIsPlainObject(value) { // 1509
var ctor, // 1510
result; // 1511
// 1512
// avoid non Object objects, `arguments` objects, and DOM elements // 1513
if (!(value && toString.call(value) == objectClass) || // 1514
(ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor))) { // 1515
return false; // 1516
} // 1517
// In most environments an object's own properties are iterated before // 1518
// its inherited properties. If the last iterated property is an object's // 1519
// own property then there are no inherited enumerable properties. // 1520
forIn(value, function(value, key) { // 1521
result = key; // 1522
}); // 1523
return typeof result == 'undefined' || hasOwnProperty.call(value, result); // 1524
} // 1525
// 1526
/** // 1527
* Used by `unescape` to convert HTML entities to characters. // 1528
* // 1529
* @private // 1530
* @param {string} match The matched character to unescape. // 1531
* @returns {string} Returns the unescaped character. // 1532
*/ // 1533
function unescapeHtmlChar(match) { // 1534
return htmlUnescapes[match]; // 1535
} // 1536
// 1537
/*--------------------------------------------------------------------------*/ // 1538
// 1539
/** // 1540
* Checks if `value` is an `arguments` object. // 1541
* // 1542
* @static // 1543
* @memberOf _ // 1544
* @category Objects // 1545
* @param {*} value The value to check. // 1546
* @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`. // 1547
* @example // 1548
* // 1549
* (function() { return _.isArguments(arguments); })(1, 2, 3); // 1550
* // => true // 1551
* // 1552
* _.isArguments([1, 2, 3]); // 1553
* // => false // 1554
*/ // 1555
function isArguments(value) { // 1556
return value && typeof value == 'object' && typeof value.length == 'number' && // 1557
toString.call(value) == argsClass || false; // 1558
} // 1559
// 1560
/** // 1561
* Checks if `value` is an array. // 1562
* // 1563
* @static // 1564
* @memberOf _ // 1565
* @type Function // 1566
* @category Objects // 1567
* @param {*} value The value to check. // 1568
* @returns {boolean} Returns `true` if the `value` is an array, else `false`. // 1569
* @example // 1570
* // 1571
* (function() { return _.isArray(arguments); })(); // 1572
* // => false // 1573
* // 1574
* _.isArray([1, 2, 3]); // 1575
* // => true // 1576
*/ // 1577
var isArray = nativeIsArray || function(value) { // 1578
return value && typeof value == 'object' && typeof value.length == 'number' && // 1579
toString.call(value) == arrayClass || false; // 1580
}; // 1581
// 1582
/** // 1583
* A fallback implementation of `Object.keys` which produces an array of the // 1584
* given object's own enumerable property names. // 1585
* // 1586
* @private // 1587
* @type Function // 1588
* @param {Object} object The object to inspect. // 1589
* @returns {Array} Returns an array of property names. // 1590
*/ // 1591
var shimKeys = function(object) { // 1592
var index, iterable = object, result = []; // 1593
if (!iterable) return result; // 1594
if (!(objectTypes[typeof object])) return result; // 1595
for (index in iterable) { // 1596
if (hasOwnProperty.call(iterable, index)) { // 1597
result.push(index); // 1598
} // 1599
} // 1600
return result // 1601
}; // 1602
// 1603
/** // 1604
* Creates an array composed of the own enumerable property names of an object. // 1605
* // 1606
* @static // 1607
* @memberOf _ // 1608
* @category Objects // 1609
* @param {Object} object The object to inspect. // 1610
* @returns {Array} Returns an array of property names. // 1611
* @example // 1612
* // 1613
* _.keys({ 'one': 1, 'two': 2, 'three': 3 }); // 1614
* // => ['one', 'two', 'three'] (property order is not guaranteed across environments) // 1615
*/ // 1616
var keys = !nativeKeys ? shimKeys : function(object) { // 1617
if (!isObject(object)) { // 1618
return []; // 1619
} // 1620
return nativeKeys(object); // 1621
}; // 1622
// 1623
/** // 1624
* Used to convert characters to HTML entities: // 1625
* // 1626
* Though the `>` character is escaped for symmetry, characters like `>` and `/` // 1627
* don't require escaping in HTML and have no special meaning unless they're part // 1628
* of a tag or an unquoted attribute value. // 1629
* http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact") // 1630
*/ // 1631
var htmlEscapes = { // 1632
'&': '&amp;', // 1633
'<': '&lt;', // 1634
'>': '&gt;', // 1635
'"': '&quot;', // 1636
"'": '&#39;' // 1637
}; // 1638
// 1639
/** Used to convert HTML entities to characters */ // 1640
var htmlUnescapes = invert(htmlEscapes); // 1641
// 1642
/** Used to match HTML entities and HTML characters */ // 1643
var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'), // 1644
reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g'); // 1645
// 1646
/*--------------------------------------------------------------------------*/ // 1647
// 1648
/** // 1649
* Assigns own enumerable properties of source object(s) to the destination // 1650
* object. Subsequent sources will overwrite property assignments of previous // 1651
* sources. If a callback is provided it will be executed to produce the // 1652
* assigned values. The callback is bound to `thisArg` and invoked with two // 1653
* arguments; (objectValue, sourceValue). // 1654
* // 1655
* @static // 1656
* @memberOf _ // 1657
* @type Function // 1658
* @alias extend // 1659
* @category Objects // 1660
* @param {Object} object The destination object. // 1661
* @param {...Object} [source] The source objects. // 1662
* @param {Function} [callback] The function to customize assigning values. // 1663
* @param {*} [thisArg] The `this` binding of `callback`. // 1664
* @returns {Object} Returns the destination object. // 1665
* @example // 1666
* // 1667
* _.assign({ 'name': 'fred' }, { 'employer': 'slate' }); // 1668
* // => { 'name': 'fred', 'employer': 'slate' } // 1669
* // 1670
* var defaults = _.partialRight(_.assign, function(a, b) { // 1671
* return typeof a == 'undefined' ? b : a; // 1672
* }); // 1673
* // 1674
* var object = { 'name': 'barney' }; // 1675
* defaults(object, { 'name': 'fred', 'employer': 'slate' }); // 1676
* // => { 'name': 'barney', 'employer': 'slate' } // 1677
*/ // 1678
var assign = function(object, source, guard) { // 1679
var index, iterable = object, result = iterable; // 1680
if (!iterable) return result; // 1681
var args = arguments, // 1682
argsIndex = 0, // 1683
argsLength = typeof guard == 'number' ? 2 : args.length; // 1684
if (argsLength > 3 && typeof args[argsLength - 2] == 'function') { // 1685
var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2); // 1686
} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') { // 1687
callback = args[--argsLength]; // 1688
} // 1689
while (++argsIndex < argsLength) { // 1690
iterable = args[argsIndex]; // 1691
if (iterable && objectTypes[typeof iterable]) { // 1692
var ownIndex = -1, // 1693
ownProps = objectTypes[typeof iterable] && keys(iterable), // 1694
length = ownProps ? ownProps.length : 0; // 1695
// 1696
while (++ownIndex < length) { // 1697
index = ownProps[ownIndex]; // 1698
result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]; // 1699
} // 1700
} // 1701
} // 1702
return result // 1703
}; // 1704
// 1705
/** // 1706
* Creates a clone of `value`. If `isDeep` is `true` nested objects will also // 1707
* be cloned, otherwise they will be assigned by reference. If a callback // 1708
* is provided it will be executed to produce the cloned values. If the // 1709
* callback returns `undefined` cloning will be handled by the method instead. // 1710
* The callback is bound to `thisArg` and invoked with one argument; (value). // 1711
* // 1712
* @static // 1713
* @memberOf _ // 1714
* @category Objects // 1715
* @param {*} value The value to clone. // 1716
* @param {boolean} [isDeep=false] Specify a deep clone. // 1717
* @param {Function} [callback] The function to customize cloning values. // 1718
* @param {*} [thisArg] The `this` binding of `callback`. // 1719
* @returns {*} Returns the cloned value. // 1720
* @example // 1721
* // 1722
* var characters = [ // 1723
* { 'name': 'barney', 'age': 36 }, // 1724
* { 'name': 'fred', 'age': 40 } // 1725
* ]; // 1726
* // 1727
* var shallow = _.clone(characters); // 1728
* shallow[0] === characters[0]; // 1729
* // => true // 1730
* // 1731
* var deep = _.clone(characters, true); // 1732
* deep[0] === characters[0]; // 1733
* // => false // 1734
* // 1735
* _.mixin({ // 1736
* 'clone': _.partialRight(_.clone, function(value) { // 1737
* return _.isElement(value) ? value.cloneNode(false) : undefined; // 1738
* }) // 1739
* }); // 1740
* // 1741
* var clone = _.clone(document.body); // 1742
* clone.childNodes.length; // 1743
* // => 0 // 1744
*/ // 1745
function clone(value, isDeep, callback, thisArg) { // 1746
// allows working with "Collections" methods without using their `index` // 1747
// and `collection` arguments for `isDeep` and `callback` // 1748
if (typeof isDeep != 'boolean' && isDeep != null) { // 1749
thisArg = callback; // 1750
callback = isDeep; // 1751
isDeep = false; // 1752
} // 1753
return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); // 1754
} // 1755
// 1756
/** // 1757
* Creates a deep clone of `value`. If a callback is provided it will be // 1758
* executed to produce the cloned values. If the callback returns `undefined` // 1759
* cloning will be handled by the method instead. The callback is bound to // 1760
* `thisArg` and invoked with one argument; (value). // 1761
* // 1762
* Note: This method is loosely based on the structured clone algorithm. Functions // 1763
* and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and // 1764
* objects created by constructors other than `Object` are cloned to plain `Object` objects. // 1765
* See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. // 1766
* // 1767
* @static // 1768
* @memberOf _ // 1769
* @category Objects // 1770
* @param {*} value The value to deep clone. // 1771
* @param {Function} [callback] The function to customize cloning values. // 1772
* @param {*} [thisArg] The `this` binding of `callback`. // 1773
* @returns {*} Returns the deep cloned value. // 1774
* @example // 1775
* // 1776
* var characters = [ // 1777
* { 'name': 'barney', 'age': 36 }, // 1778
* { 'name': 'fred', 'age': 40 } // 1779
* ]; // 1780
* // 1781
* var deep = _.cloneDeep(characters); // 1782
* deep[0] === characters[0]; // 1783
* // => false // 1784
* // 1785
* var view = { // 1786
* 'label': 'docs', // 1787
* 'node': element // 1788
* }; // 1789
* // 1790
* var clone = _.cloneDeep(view, function(value) { // 1791
* return _.isElement(value) ? value.cloneNode(true) : undefined; // 1792
* }); // 1793
* // 1794
* clone.node == view.node; // 1795
* // => false // 1796
*/ // 1797
function cloneDeep(value, callback, thisArg) { // 1798
return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); // 1799
} // 1800
// 1801
/** // 1802
* Creates an object that inherits from the given `prototype` object. If a // 1803
* `properties` object is provided its own enumerable properties are assigned // 1804
* to the created object. // 1805
* // 1806
* @static // 1807
* @memberOf _ // 1808
* @category Objects // 1809
* @param {Object} prototype The object to inherit from. // 1810
* @param {Object} [properties] The properties to assign to the object. // 1811
* @returns {Object} Returns the new object. // 1812
* @example // 1813
* // 1814
* function Shape() { // 1815
* this.x = 0; // 1816
* this.y = 0; // 1817
* } // 1818
* // 1819
* function Circle() { // 1820
* Shape.call(this); // 1821
* } // 1822
* // 1823
* Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle }); // 1824
* // 1825
* var circle = new Circle; // 1826
* circle instanceof Circle; // 1827
* // => true // 1828
* // 1829
* circle instanceof Shape; // 1830
* // => true // 1831
*/ // 1832
function create(prototype, properties) { // 1833
var result = baseCreate(prototype); // 1834
return properties ? assign(result, properties) : result; // 1835
} // 1836
// 1837
/** // 1838
* Assigns own enumerable properties of source object(s) to the destination // 1839
* object for all destination properties that resolve to `undefined`. Once a // 1840
* property is set, additional defaults of the same property will be ignored. // 1841
* // 1842
* @static // 1843
* @memberOf _ // 1844
* @type Function // 1845
* @category Objects // 1846
* @param {Object} object The destination object. // 1847
* @param {...Object} [source] The source objects. // 1848
* @param- {Object} [guard] Allows working with `_.reduce` without using its // 1849
* `key` and `object` arguments as sources. // 1850
* @returns {Object} Returns the destination object. // 1851
* @example // 1852
* // 1853
* var object = { 'name': 'barney' }; // 1854
* _.defaults(object, { 'name': 'fred', 'employer': 'slate' }); // 1855
* // => { 'name': 'barney', 'employer': 'slate' } // 1856
*/ // 1857
var defaults = function(object, source, guard) { // 1858
var index, iterable = object, result = iterable; // 1859
if (!iterable) return result; // 1860
var args = arguments, // 1861
argsIndex = 0, // 1862
argsLength = typeof guard == 'number' ? 2 : args.length; // 1863
while (++argsIndex < argsLength) { // 1864
iterable = args[argsIndex]; // 1865
if (iterable && objectTypes[typeof iterable]) { // 1866
var ownIndex = -1, // 1867
ownProps = objectTypes[typeof iterable] && keys(iterable), // 1868
length = ownProps ? ownProps.length : 0; // 1869
// 1870
while (++ownIndex < length) { // 1871
index = ownProps[ownIndex]; // 1872
if (typeof result[index] == 'undefined') result[index] = iterable[index]; // 1873
} // 1874
} // 1875
} // 1876
return result // 1877
}; // 1878
// 1879
/** // 1880
* This method is like `_.findIndex` except that it returns the key of the // 1881
* first element that passes the callback check, instead of the element itself. // 1882
* // 1883
* If a property name is provided for `callback` the created "_.pluck" style // 1884
* callback will return the property value of the given element. // 1885
* // 1886
* If an object is provided for `callback` the created "_.where" style callback // 1887
* will return `true` for elements that have the properties of the given object, // 1888
* else `false`. // 1889
* // 1890
* @static // 1891
* @memberOf _ // 1892
* @category Objects // 1893
* @param {Object} object The object to search. // 1894
* @param {Function|Object|string} [callback=identity] The function called per // 1895
* iteration. If a property name or object is provided it will be used to // 1896
* create a "_.pluck" or "_.where" style callback, respectively. // 1897
* @param {*} [thisArg] The `this` binding of `callback`. // 1898
* @returns {string|undefined} Returns the key of the found element, else `undefined`. // 1899
* @example // 1900
* // 1901
* var characters = { // 1902
* 'barney': { 'age': 36, 'blocked': false }, // 1903
* 'fred': { 'age': 40, 'blocked': true }, // 1904
* 'pebbles': { 'age': 1, 'blocked': false } // 1905
* }; // 1906
* // 1907
* _.findKey(characters, function(chr) { // 1908
* return chr.age < 40; // 1909
* }); // 1910
* // => 'barney' (property order is not guaranteed across environments) // 1911
* // 1912
* // using "_.where" callback shorthand // 1913
* _.findKey(characters, { 'age': 1 }); // 1914
* // => 'pebbles' // 1915
* // 1916
* // using "_.pluck" callback shorthand // 1917
* _.findKey(characters, 'blocked'); // 1918
* // => 'fred' // 1919
*/ // 1920
function findKey(object, callback, thisArg) { // 1921
var result; // 1922
callback = lodash.createCallback(callback, thisArg, 3); // 1923
forOwn(object, function(value, key, object) { // 1924
if (callback(value, key, object)) { // 1925
result = key; // 1926
return false; // 1927
} // 1928
}); // 1929
return result; // 1930
} // 1931
// 1932
/** // 1933
* This method is like `_.findKey` except that it iterates over elements // 1934
* of a `collection` in the opposite order. // 1935
* // 1936
* If a property name is provided for `callback` the created "_.pluck" style // 1937
* callback will return the property value of the given element. // 1938
* // 1939
* If an object is provided for `callback` the created "_.where" style callback // 1940
* will return `true` for elements that have the properties of the given object, // 1941
* else `false`. // 1942
* // 1943
* @static // 1944
* @memberOf _ // 1945
* @category Objects // 1946
* @param {Object} object The object to search. // 1947
* @param {Function|Object|string} [callback=identity] The function called per // 1948
* iteration. If a property name or object is provided it will be used to // 1949
* create a "_.pluck" or "_.where" style callback, respectively. // 1950
* @param {*} [thisArg] The `this` binding of `callback`. // 1951
* @returns {string|undefined} Returns the key of the found element, else `undefined`. // 1952
* @example // 1953
* // 1954
* var characters = { // 1955
* 'barney': { 'age': 36, 'blocked': true }, // 1956
* 'fred': { 'age': 40, 'blocked': false }, // 1957
* 'pebbles': { 'age': 1, 'blocked': true } // 1958
* }; // 1959
* // 1960
* _.findLastKey(characters, function(chr) { // 1961
* return chr.age < 40; // 1962
* }); // 1963
* // => returns `pebbles`, assuming `_.findKey` returns `barney` // 1964
* // 1965
* // using "_.where" callback shorthand // 1966
* _.findLastKey(characters, { 'age': 40 }); // 1967
* // => 'fred' // 1968
* // 1969
* // using "_.pluck" callback shorthand // 1970
* _.findLastKey(characters, 'blocked'); // 1971
* // => 'pebbles' // 1972
*/ // 1973
function findLastKey(object, callback, thisArg) { // 1974
var result; // 1975
callback = lodash.createCallback(callback, thisArg, 3); // 1976
forOwnRight(object, function(value, key, object) { // 1977
if (callback(value, key, object)) { // 1978
result = key; // 1979
return false; // 1980
} // 1981
}); // 1982
return result; // 1983
} // 1984
// 1985
/** // 1986
* Iterates over own and inherited enumerable properties of an object, // 1987
* executing the callback for each property. The callback is bound to `thisArg` // 1988
* and invoked with three arguments; (value, key, object). Callbacks may exit // 1989
* iteration early by explicitly returning `false`. // 1990
* // 1991
* @static // 1992
* @memberOf _ // 1993
* @type Function // 1994
* @category Objects // 1995
* @param {Object} object The object to iterate over. // 1996
* @param {Function} [callback=identity] The function called per iteration. // 1997
* @param {*} [thisArg] The `this` binding of `callback`. // 1998
* @returns {Object} Returns `object`. // 1999
* @example // 2000
* // 2001
* function Shape() { // 2002
* this.x = 0; // 2003
* this.y = 0; // 2004
* } // 2005
* // 2006
* Shape.prototype.move = function(x, y) { // 2007
* this.x += x; // 2008
* this.y += y; // 2009
* }; // 2010
* // 2011
* _.forIn(new Shape, function(value, key) { // 2012
* console.log(key); // 2013
* }); // 2014
* // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments) // 2015
*/ // 2016
var forIn = function(collection, callback, thisArg) { // 2017
var index, iterable = collection, result = iterable; // 2018
if (!iterable) return result; // 2019
if (!objectTypes[typeof iterable]) return result; // 2020
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); // 2021
for (index in iterable) { // 2022
if (callback(iterable[index], index, collection) === false) return result; // 2023
} // 2024
return result // 2025
}; // 2026
// 2027
/** // 2028
* This method is like `_.forIn` except that it iterates over elements // 2029
* of a `collection` in the opposite order. // 2030
* // 2031
* @static // 2032
* @memberOf _ // 2033
* @category Objects // 2034
* @param {Object} object The object to iterate over. // 2035
* @param {Function} [callback=identity] The function called per iteration. // 2036
* @param {*} [thisArg] The `this` binding of `callback`. // 2037
* @returns {Object} Returns `object`. // 2038
* @example // 2039
* // 2040
* function Shape() { // 2041
* this.x = 0; // 2042
* this.y = 0; // 2043
* } // 2044
* // 2045
* Shape.prototype.move = function(x, y) { // 2046
* this.x += x; // 2047
* this.y += y; // 2048
* }; // 2049
* // 2050
* _.forInRight(new Shape, function(value, key) { // 2051
* console.log(key); // 2052
* }); // 2053
* // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move' // 2054
*/ // 2055
function forInRight(object, callback, thisArg) { // 2056
var pairs = []; // 2057
// 2058
forIn(object, function(value, key) { // 2059
pairs.push(key, value); // 2060
}); // 2061
// 2062
var length = pairs.length; // 2063
callback = baseCreateCallback(callback, thisArg, 3); // 2064
while (length--) { // 2065
if (callback(pairs[length--], pairs[length], object) === false) { // 2066
break; // 2067
} // 2068
} // 2069
return object; // 2070
} // 2071
// 2072
/** // 2073
* Iterates over own enumerable properties of an object, executing the callback // 2074
* for each property. The callback is bound to `thisArg` and invoked with three // 2075
* arguments; (value, key, object). Callbacks may exit iteration early by // 2076
* explicitly returning `false`. // 2077
* // 2078
* @static // 2079
* @memberOf _ // 2080
* @type Function // 2081
* @category Objects // 2082
* @param {Object} object The object to iterate over. // 2083
* @param {Function} [callback=identity] The function called per iteration. // 2084
* @param {*} [thisArg] The `this` binding of `callback`. // 2085
* @returns {Object} Returns `object`. // 2086
* @example // 2087
* // 2088
* _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { // 2089
* console.log(key); // 2090
* }); // 2091
* // => logs '0', '1', and 'length' (property order is not guaranteed across environments) // 2092
*/ // 2093
var forOwn = function(collection, callback, thisArg) { // 2094
var index, iterable = collection, result = iterable; // 2095
if (!iterable) return result; // 2096
if (!objectTypes[typeof iterable]) return result; // 2097
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); // 2098
var ownIndex = -1, // 2099
ownProps = objectTypes[typeof iterable] && keys(iterable), // 2100
length = ownProps ? ownProps.length : 0; // 2101
// 2102
while (++ownIndex < length) { // 2103
index = ownProps[ownIndex]; // 2104
if (callback(iterable[index], index, collection) === false) return result; // 2105
} // 2106
return result // 2107
}; // 2108
// 2109
/** // 2110
* This method is like `_.forOwn` except that it iterates over elements // 2111
* of a `collection` in the opposite order. // 2112
* // 2113
* @static // 2114
* @memberOf _ // 2115
* @category Objects // 2116
* @param {Object} object The object to iterate over. // 2117
* @param {Function} [callback=identity] The function called per iteration. // 2118
* @param {*} [thisArg] The `this` binding of `callback`. // 2119
* @returns {Object} Returns `object`. // 2120
* @example // 2121
* // 2122
* _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { // 2123
* console.log(key); // 2124
* }); // 2125
* // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' // 2126
*/ // 2127
function forOwnRight(object, callback, thisArg) { // 2128
var props = keys(object), // 2129
length = props.length; // 2130
// 2131
callback = baseCreateCallback(callback, thisArg, 3); // 2132
while (length--) { // 2133
var key = props[length]; // 2134
if (callback(object[key], key, object) === false) { // 2135
break; // 2136
} // 2137
} // 2138
return object; // 2139
} // 2140
// 2141
/** // 2142
* Creates a sorted array of property names of all enumerable properties, // 2143
* own and inherited, of `object` that have function values. // 2144
* // 2145
* @static // 2146
* @memberOf _ // 2147
* @alias methods // 2148
* @category Objects // 2149
* @param {Object} object The object to inspect. // 2150
* @returns {Array} Returns an array of property names that have function values. // 2151
* @example // 2152
* // 2153
* _.functions(_); // 2154
* // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] // 2155
*/ // 2156
function functions(object) { // 2157
var result = []; // 2158
forIn(object, function(value, key) { // 2159
if (isFunction(value)) { // 2160
result.push(key); // 2161
} // 2162
}); // 2163
return result.sort(); // 2164
} // 2165
// 2166
/** // 2167
* Checks if the specified property name exists as a direct property of `object`, // 2168
* instead of an inherited property. // 2169
* // 2170
* @static // 2171
* @memberOf _ // 2172
* @category Objects // 2173
* @param {Object} object The object to inspect. // 2174
* @param {string} key The name of the property to check. // 2175
* @returns {boolean} Returns `true` if key is a direct property, else `false`. // 2176
* @example // 2177
* // 2178
* _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); // 2179
* // => true // 2180
*/ // 2181
function has(object, key) { // 2182
return object ? hasOwnProperty.call(object, key) : false; // 2183
} // 2184
// 2185
/** // 2186
* Creates an object composed of the inverted keys and values of the given object. // 2187
* // 2188
* @static // 2189
* @memberOf _ // 2190
* @category Objects // 2191
* @param {Object} object The object to invert. // 2192
* @returns {Object} Returns the created inverted object. // 2193
* @example // 2194
* // 2195
* _.invert({ 'first': 'fred', 'second': 'barney' }); // 2196
* // => { 'fred': 'first', 'barney': 'second' } // 2197
*/ // 2198
function invert(object) { // 2199
var index = -1, // 2200
props = keys(object), // 2201
length = props.length, // 2202
result = {}; // 2203
// 2204
while (++index < length) { // 2205
var key = props[index]; // 2206
result[object[key]] = key; // 2207
} // 2208
return result; // 2209
} // 2210
// 2211
/** // 2212
* Checks if `value` is a boolean value. // 2213
* // 2214
* @static // 2215
* @memberOf _ // 2216
* @category Objects // 2217
* @param {*} value The value to check. // 2218
* @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`. // 2219
* @example // 2220
* // 2221
* _.isBoolean(null); // 2222
* // => false // 2223
*/ // 2224
function isBoolean(value) { // 2225
return value === true || value === false || // 2226
value && typeof value == 'object' && toString.call(value) == boolClass || false; // 2227
} // 2228
// 2229
/** // 2230
* Checks if `value` is a date. // 2231
* // 2232
* @static // 2233
* @memberOf _ // 2234
* @category Objects // 2235
* @param {*} value The value to check. // 2236
* @returns {boolean} Returns `true` if the `value` is a date, else `false`. // 2237
* @example // 2238
* // 2239
* _.isDate(new Date); // 2240
* // => true // 2241
*/ // 2242
function isDate(value) { // 2243
return value && typeof value == 'object' && toString.call(value) == dateClass || false; // 2244
} // 2245
// 2246
/** // 2247
* Checks if `value` is a DOM element. // 2248
* // 2249
* @static // 2250
* @memberOf _ // 2251
* @category Objects // 2252
* @param {*} value The value to check. // 2253
* @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`. // 2254
* @example // 2255
* // 2256
* _.isElement(document.body); // 2257
* // => true // 2258
*/ // 2259
function isElement(value) { // 2260
return value && value.nodeType === 1 || false; // 2261
} // 2262
// 2263
/** // 2264
* Checks if `value` is empty. Arrays, strings, or `arguments` objects with a // 2265
* length of `0` and objects with no own enumerable properties are considered // 2266
* "empty". // 2267
* // 2268
* @static // 2269
* @memberOf _ // 2270
* @category Objects // 2271
* @param {Array|Object|string} value The value to inspect. // 2272
* @returns {boolean} Returns `true` if the `value` is empty, else `false`. // 2273
* @example // 2274
* // 2275
* _.isEmpty([1, 2, 3]); // 2276
* // => false // 2277
* // 2278
* _.isEmpty({}); // 2279
* // => true // 2280
* // 2281
* _.isEmpty(''); // 2282
* // => true // 2283
*/ // 2284
function isEmpty(value) { // 2285
var result = true; // 2286
if (!value) { // 2287
return result; // 2288
} // 2289
var className = toString.call(value), // 2290
length = value.length; // 2291
// 2292
if ((className == arrayClass || className == stringClass || className == argsClass ) || // 2293
(className == objectClass && typeof length == 'number' && isFunction(value.splice))) { // 2294
return !length; // 2295
} // 2296
forOwn(value, function() { // 2297
return (result = false); // 2298
}); // 2299
return result; // 2300
} // 2301
// 2302
/** // 2303
* Performs a deep comparison between two values to determine if they are // 2304
* equivalent to each other. If a callback is provided it will be executed // 2305
* to compare values. If the callback returns `undefined` comparisons will // 2306
* be handled by the method instead. The callback is bound to `thisArg` and // 2307
* invoked with two arguments; (a, b). // 2308
* // 2309
* @static // 2310
* @memberOf _ // 2311
* @category Objects // 2312
* @param {*} a The value to compare. // 2313
* @param {*} b The other value to compare. // 2314
* @param {Function} [callback] The function to customize comparing values. // 2315
* @param {*} [thisArg] The `this` binding of `callback`. // 2316
* @returns {boolean} Returns `true` if the values are equivalent, else `false`. // 2317
* @example // 2318
* // 2319
* var object = { 'name': 'fred' }; // 2320
* var copy = { 'name': 'fred' }; // 2321
* // 2322
* object == copy; // 2323
* // => false // 2324
* // 2325
* _.isEqual(object, copy); // 2326
* // => true // 2327
* // 2328
* var words = ['hello', 'goodbye']; // 2329
* var otherWords = ['hi', 'goodbye']; // 2330
* // 2331
* _.isEqual(words, otherWords, function(a, b) { // 2332
* var reGreet = /^(?:hello|hi)$/i, // 2333
* aGreet = _.isString(a) && reGreet.test(a), // 2334
* bGreet = _.isString(b) && reGreet.test(b); // 2335
* // 2336
* return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; // 2337
* }); // 2338
* // => true // 2339
*/ // 2340
function isEqual(a, b, callback, thisArg) { // 2341
return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2)); // 2342
} // 2343
// 2344
/** // 2345
* Checks if `value` is, or can be coerced to, a finite number. // 2346
* // 2347
* Note: This is not the same as native `isFinite` which will return true for // 2348
* booleans and empty strings. See http://es5.github.io/#x15.1.2.5. // 2349
* // 2350
* @static // 2351
* @memberOf _ // 2352
* @category Objects // 2353
* @param {*} value The value to check. // 2354
* @returns {boolean} Returns `true` if the `value` is finite, else `false`. // 2355
* @example // 2356
* // 2357
* _.isFinite(-101); // 2358
* // => true // 2359
* // 2360
* _.isFinite('10'); // 2361
* // => true // 2362
* // 2363
* _.isFinite(true); // 2364
* // => false // 2365
* // 2366
* _.isFinite(''); // 2367
* // => false // 2368
* // 2369
* _.isFinite(Infinity); // 2370
* // => false // 2371
*/ // 2372
function isFinite(value) { // 2373
return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); // 2374
} // 2375
// 2376
/** // 2377
* Checks if `value` is a function. // 2378
* // 2379
* @static // 2380
* @memberOf _ // 2381
* @category Objects // 2382
* @param {*} value The value to check. // 2383
* @returns {boolean} Returns `true` if the `value` is a function, else `false`. // 2384
* @example // 2385
* // 2386
* _.isFunction(_); // 2387
* // => true // 2388
*/ // 2389
function isFunction(value) { // 2390
return typeof value == 'function'; // 2391
} // 2392
// 2393
/** // 2394
* Checks if `value` is the language type of Object. // 2395
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) // 2396
* // 2397
* @static // 2398
* @memberOf _ // 2399
* @category Objects // 2400
* @param {*} value The value to check. // 2401
* @returns {boolean} Returns `true` if the `value` is an object, else `false`. // 2402
* @example // 2403
* // 2404
* _.isObject({}); // 2405
* // => true // 2406
* // 2407
* _.isObject([1, 2, 3]); // 2408
* // => true // 2409
* // 2410
* _.isObject(1); // 2411
* // => false // 2412
*/ // 2413
function isObject(value) { // 2414
// check if the value is the ECMAScript language type of Object // 2415
// http://es5.github.io/#x8 // 2416
// and avoid a V8 bug // 2417
// http://code.google.com/p/v8/issues/detail?id=2291 // 2418
return !!(value && objectTypes[typeof value]); // 2419
} // 2420
// 2421
/** // 2422
* Checks if `value` is `NaN`. // 2423
* // 2424
* Note: This is not the same as native `isNaN` which will return `true` for // 2425
* `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. // 2426
* // 2427
* @static // 2428
* @memberOf _ // 2429
* @category Objects // 2430
* @param {*} value The value to check. // 2431
* @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`. // 2432
* @example // 2433
* // 2434
* _.isNaN(NaN); // 2435
* // => true // 2436
* // 2437
* _.isNaN(new Number(NaN)); // 2438
* // => true // 2439
* // 2440
* isNaN(undefined); // 2441
* // => true // 2442
* // 2443
* _.isNaN(undefined); // 2444
* // => false // 2445
*/ // 2446
function isNaN(value) { // 2447
// `NaN` as a primitive is the only value that is not equal to itself // 2448
// (perform the [[Class]] check first to avoid errors with some host objects in IE) // 2449
return isNumber(value) && value != +value; // 2450
} // 2451
// 2452
/** // 2453
* Checks if `value` is `null`. // 2454
* // 2455
* @static // 2456
* @memberOf _ // 2457
* @category Objects // 2458
* @param {*} value The value to check. // 2459
* @returns {boolean} Returns `true` if the `value` is `null`, else `false`. // 2460
* @example // 2461
* // 2462
* _.isNull(null); // 2463
* // => true // 2464
* // 2465
* _.isNull(undefined); // 2466
* // => false // 2467
*/ // 2468
function isNull(value) { // 2469
return value === null; // 2470
} // 2471
// 2472
/** // 2473
* Checks if `value` is a number. // 2474
* // 2475
* Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. // 2476
* // 2477
* @static // 2478
* @memberOf _ // 2479
* @category Objects // 2480
* @param {*} value The value to check. // 2481
* @returns {boolean} Returns `true` if the `value` is a number, else `false`. // 2482
* @example // 2483
* // 2484
* _.isNumber(8.4 * 5); // 2485
* // => true // 2486
*/ // 2487
function isNumber(value) { // 2488
return typeof value == 'number' || // 2489
value && typeof value == 'object' && toString.call(value) == numberClass || false; // 2490
} // 2491
// 2492
/** // 2493
* Checks if `value` is an object created by the `Object` constructor. // 2494
* // 2495
* @static // 2496
* @memberOf _ // 2497
* @category Objects // 2498
* @param {*} value The value to check. // 2499
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`. // 2500
* @example // 2501
* // 2502
* function Shape() { // 2503
* this.x = 0; // 2504
* this.y = 0; // 2505
* } // 2506
* // 2507
* _.isPlainObject(new Shape); // 2508
* // => false // 2509
* // 2510
* _.isPlainObject([1, 2, 3]); // 2511
* // => false // 2512
* // 2513
* _.isPlainObject({ 'x': 0, 'y': 0 }); // 2514
* // => true // 2515
*/ // 2516
var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { // 2517
if (!(value && toString.call(value) == objectClass)) { // 2518
return false; // 2519
} // 2520
var valueOf = value.valueOf, // 2521
objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); // 2522
// 2523
return objProto // 2524
? (value == objProto || getPrototypeOf(value) == objProto) // 2525
: shimIsPlainObject(value); // 2526
}; // 2527
// 2528
/** // 2529
* Checks if `value` is a regular expression. // 2530
* // 2531
* @static // 2532
* @memberOf _ // 2533
* @category Objects // 2534
* @param {*} value The value to check. // 2535
* @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`. // 2536
* @example // 2537
* // 2538
* _.isRegExp(/fred/); // 2539
* // => true // 2540
*/ // 2541
function isRegExp(value) { // 2542
return value && typeof value == 'object' && toString.call(value) == regexpClass || false; // 2543
} // 2544
// 2545
/** // 2546
* Checks if `value` is a string. // 2547
* // 2548
* @static // 2549
* @memberOf _ // 2550
* @category Objects // 2551
* @param {*} value The value to check. // 2552
* @returns {boolean} Returns `true` if the `value` is a string, else `false`. // 2553
* @example // 2554
* // 2555
* _.isString('fred'); // 2556
* // => true // 2557
*/ // 2558
function isString(value) { // 2559
return typeof value == 'string' || // 2560
value && typeof value == 'object' && toString.call(value) == stringClass || false; // 2561
} // 2562
// 2563
/** // 2564
* Checks if `value` is `undefined`. // 2565
* // 2566
* @static // 2567
* @memberOf _ // 2568
* @category Objects // 2569
* @param {*} value The value to check. // 2570
* @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`. // 2571
* @example // 2572
* // 2573
* _.isUndefined(void 0); // 2574
* // => true // 2575
*/ // 2576
function isUndefined(value) { // 2577
return typeof value == 'undefined'; // 2578
} // 2579
// 2580
/** // 2581
* Creates an object with the same keys as `object` and values generated by // 2582
* running each own enumerable property of `object` through the callback. // 2583
* The callback is bound to `thisArg` and invoked with three arguments; // 2584
* (value, key, object). // 2585
* // 2586
* If a property name is provided for `callback` the created "_.pluck" style // 2587
* callback will return the property value of the given element. // 2588
* // 2589
* If an object is provided for `callback` the created "_.where" style callback // 2590
* will return `true` for elements that have the properties of the given object, // 2591
* else `false`. // 2592
* // 2593
* @static // 2594
* @memberOf _ // 2595
* @category Objects // 2596
* @param {Object} object The object to iterate over. // 2597
* @param {Function|Object|string} [callback=identity] The function called // 2598
* per iteration. If a property name or object is provided it will be used // 2599
* to create a "_.pluck" or "_.where" style callback, respectively. // 2600
* @param {*} [thisArg] The `this` binding of `callback`. // 2601
* @returns {Array} Returns a new object with values of the results of each `callback` execution. // 2602
* @example // 2603
* // 2604
* _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; }); // 2605
* // => { 'a': 3, 'b': 6, 'c': 9 } // 2606
* // 2607
* var characters = { // 2608
* 'fred': { 'name': 'fred', 'age': 40 }, // 2609
* 'pebbles': { 'name': 'pebbles', 'age': 1 } // 2610
* }; // 2611
* // 2612
* // using "_.pluck" callback shorthand // 2613
* _.mapValues(characters, 'age'); // 2614
* // => { 'fred': 40, 'pebbles': 1 } // 2615
*/ // 2616
function mapValues(object, callback, thisArg) { // 2617
var result = {}; // 2618
callback = lodash.createCallback(callback, thisArg, 3); // 2619
// 2620
forOwn(object, function(value, key, object) { // 2621
result[key] = callback(value, key, object); // 2622
}); // 2623
return result; // 2624
} // 2625
// 2626
/** // 2627
* Recursively merges own enumerable properties of the source object(s), that // 2628
* don't resolve to `undefined` into the destination object. Subsequent sources // 2629
* will overwrite property assignments of previous sources. If a callback is // 2630
* provided it will be executed to produce the merged values of the destination // 2631
* and source properties. If the callback returns `undefined` merging will // 2632
* be handled by the method instead. The callback is bound to `thisArg` and // 2633
* invoked with two arguments; (objectValue, sourceValue). // 2634
* // 2635
* @static // 2636
* @memberOf _ // 2637
* @category Objects // 2638
* @param {Object} object The destination object. // 2639
* @param {...Object} [source] The source objects. // 2640
* @param {Function} [callback] The function to customize merging properties. // 2641
* @param {*} [thisArg] The `this` binding of `callback`. // 2642
* @returns {Object} Returns the destination object. // 2643
* @example // 2644
* // 2645
* var names = { // 2646
* 'characters': [ // 2647
* { 'name': 'barney' }, // 2648
* { 'name': 'fred' } // 2649
* ] // 2650
* }; // 2651
* // 2652
* var ages = { // 2653
* 'characters': [ // 2654
* { 'age': 36 }, // 2655
* { 'age': 40 } // 2656
* ] // 2657
* }; // 2658
* // 2659
* _.merge(names, ages); // 2660
* // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] } // 2661
* // 2662
* var food = { // 2663
* 'fruits': ['apple'], // 2664
* 'vegetables': ['beet'] // 2665
* }; // 2666
* // 2667
* var otherFood = { // 2668
* 'fruits': ['banana'], // 2669
* 'vegetables': ['carrot'] // 2670
* }; // 2671
* // 2672
* _.merge(food, otherFood, function(a, b) { // 2673
* return _.isArray(a) ? a.concat(b) : undefined; // 2674
* }); // 2675
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } // 2676
*/ // 2677
function merge(object) { // 2678
var args = arguments, // 2679
length = 2; // 2680
// 2681
if (!isObject(object)) { // 2682
return object; // 2683
} // 2684
// allows working with `_.reduce` and `_.reduceRight` without using // 2685
// their `index` and `collection` arguments // 2686
if (typeof args[2] != 'number') { // 2687
length = args.length; // 2688
} // 2689
if (length > 3 && typeof args[length - 2] == 'function') { // 2690
var callback = baseCreateCallback(args[--length - 1], args[length--], 2); // 2691
} else if (length > 2 && typeof args[length - 1] == 'function') { // 2692
callback = args[--length]; // 2693
} // 2694
var sources = slice(arguments, 1, length), // 2695
index = -1, // 2696
stackA = getArray(), // 2697
stackB = getArray(); // 2698
// 2699
while (++index < length) { // 2700
baseMerge(object, sources[index], callback, stackA, stackB); // 2701
} // 2702
releaseArray(stackA); // 2703
releaseArray(stackB); // 2704
return object; // 2705
} // 2706
// 2707
/** // 2708
* Creates a shallow clone of `object` excluding the specified properties. // 2709
* Property names may be specified as individual arguments or as arrays of // 2710
* property names. If a callback is provided it will be executed for each // 2711
* property of `object` omitting the properties the callback returns truey // 2712
* for. The callback is bound to `thisArg` and invoked with three arguments; // 2713
* (value, key, object). // 2714
* // 2715
* @static // 2716
* @memberOf _ // 2717
* @category Objects // 2718
* @param {Object} object The source object. // 2719
* @param {Function|...string|string[]} [callback] The properties to omit or the // 2720
* function called per iteration. // 2721
* @param {*} [thisArg] The `this` binding of `callback`. // 2722
* @returns {Object} Returns an object without the omitted properties. // 2723
* @example // 2724
* // 2725
* _.omit({ 'name': 'fred', 'age': 40 }, 'age'); // 2726
* // => { 'name': 'fred' } // 2727
* // 2728
* _.omit({ 'name': 'fred', 'age': 40 }, function(value) { // 2729
* return typeof value == 'number'; // 2730
* }); // 2731
* // => { 'name': 'fred' } // 2732
*/ // 2733
function omit(object, callback, thisArg) { // 2734
var result = {}; // 2735
if (typeof callback != 'function') { // 2736
var props = []; // 2737
forIn(object, function(value, key) { // 2738
props.push(key); // 2739
}); // 2740
props = baseDifference(props, baseFlatten(arguments, true, false, 1)); // 2741
// 2742
var index = -1, // 2743
length = props.length; // 2744
// 2745
while (++index < length) { // 2746
var key = props[index]; // 2747
result[key] = object[key]; // 2748
} // 2749
} else { // 2750
callback = lodash.createCallback(callback, thisArg, 3); // 2751
forIn(object, function(value, key, object) { // 2752
if (!callback(value, key, object)) { // 2753
result[key] = value; // 2754
} // 2755
}); // 2756
} // 2757
return result; // 2758
} // 2759
// 2760
/** // 2761
* Creates a two dimensional array of an object's key-value pairs, // 2762
* i.e. `[[key1, value1], [key2, value2]]`. // 2763
* // 2764
* @static // 2765
* @memberOf _ // 2766
* @category Objects // 2767
* @param {Object} object The object to inspect. // 2768
* @returns {Array} Returns new array of key-value pairs. // 2769
* @example // 2770
* // 2771
* _.pairs({ 'barney': 36, 'fred': 40 }); // 2772
* // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments) // 2773
*/ // 2774
function pairs(object) { // 2775
var index = -1, // 2776
props = keys(object), // 2777
length = props.length, // 2778
result = Array(length); // 2779
// 2780
while (++index < length) { // 2781
var key = props[index]; // 2782
result[index] = [key, object[key]]; // 2783
} // 2784
return result; // 2785
} // 2786
// 2787
/** // 2788
* Creates a shallow clone of `object` composed of the specified properties. // 2789
* Property names may be specified as individual arguments or as arrays of // 2790
* property names. If a callback is provided it will be executed for each // 2791
* property of `object` picking the properties the callback returns truey // 2792
* for. The callback is bound to `thisArg` and invoked with three arguments; // 2793
* (value, key, object). // 2794
* // 2795
* @static // 2796
* @memberOf _ // 2797
* @category Objects // 2798
* @param {Object} object The source object. // 2799
* @param {Function|...string|string[]} [callback] The function called per // 2800
* iteration or property names to pick, specified as individual property // 2801
* names or arrays of property names. // 2802
* @param {*} [thisArg] The `this` binding of `callback`. // 2803
* @returns {Object} Returns an object composed of the picked properties. // 2804
* @example // 2805
* // 2806
* _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name'); // 2807
* // => { 'name': 'fred' } // 2808
* // 2809
* _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) { // 2810
* return key.charAt(0) != '_'; // 2811
* }); // 2812
* // => { 'name': 'fred' } // 2813
*/ // 2814
function pick(object, callback, thisArg) { // 2815
var result = {}; // 2816
if (typeof callback != 'function') { // 2817
var index = -1, // 2818
props = baseFlatten(arguments, true, false, 1), // 2819
length = isObject(object) ? props.length : 0; // 2820
// 2821
while (++index < length) { // 2822
var key = props[index]; // 2823
if (key in object) { // 2824
result[key] = object[key]; // 2825
} // 2826
} // 2827
} else { // 2828
callback = lodash.createCallback(callback, thisArg, 3); // 2829
forIn(object, function(value, key, object) { // 2830
if (callback(value, key, object)) { // 2831
result[key] = value; // 2832
} // 2833
}); // 2834
} // 2835
return result; // 2836
} // 2837
// 2838
/** // 2839
* An alternative to `_.reduce` this method transforms `object` to a new // 2840
* `accumulator` object which is the result of running each of its own // 2841
* enumerable properties through a callback, with each callback execution // 2842
* potentially mutating the `accumulator` object. The callback is bound to // 2843
* `thisArg` and invoked with four arguments; (accumulator, value, key, object). // 2844
* Callbacks may exit iteration early by explicitly returning `false`. // 2845
* // 2846
* @static // 2847
* @memberOf _ // 2848
* @category Objects // 2849
* @param {Array|Object} object The object to iterate over. // 2850
* @param {Function} [callback=identity] The function called per iteration. // 2851
* @param {*} [accumulator] The custom accumulator value. // 2852
* @param {*} [thisArg] The `this` binding of `callback`. // 2853
* @returns {*} Returns the accumulated value. // 2854
* @example // 2855
* // 2856
* var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { // 2857
* num *= num; // 2858
* if (num % 2) { // 2859
* return result.push(num) < 3; // 2860
* } // 2861
* }); // 2862
* // => [1, 9, 25] // 2863
* // 2864
* var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { // 2865
* result[key] = num * 3; // 2866
* }); // 2867
* // => { 'a': 3, 'b': 6, 'c': 9 } // 2868
*/ // 2869
function transform(object, callback, accumulator, thisArg) { // 2870
var isArr = isArray(object); // 2871
if (accumulator == null) { // 2872
if (isArr) { // 2873
accumulator = []; // 2874
} else { // 2875
var ctor = object && object.constructor, // 2876
proto = ctor && ctor.prototype; // 2877
// 2878
accumulator = baseCreate(proto); // 2879
} // 2880
} // 2881
if (callback) { // 2882
callback = lodash.createCallback(callback, thisArg, 4); // 2883
(isArr ? forEach : forOwn)(object, function(value, index, object) { // 2884
return callback(accumulator, value, index, object); // 2885
}); // 2886
} // 2887
return accumulator; // 2888
} // 2889
// 2890
/** // 2891
* Creates an array composed of the own enumerable property values of `object`. // 2892
* // 2893
* @static // 2894
* @memberOf _ // 2895
* @category Objects // 2896
* @param {Object} object The object to inspect. // 2897
* @returns {Array} Returns an array of property values. // 2898
* @example // 2899
* // 2900
* _.values({ 'one': 1, 'two': 2, 'three': 3 }); // 2901
* // => [1, 2, 3] (property order is not guaranteed across environments) // 2902
*/ // 2903
function values(object) { // 2904
var index = -1, // 2905
props = keys(object), // 2906
length = props.length, // 2907
result = Array(length); // 2908
// 2909
while (++index < length) { // 2910
result[index] = object[props[index]]; // 2911
} // 2912
return result; // 2913
} // 2914
// 2915
/*--------------------------------------------------------------------------*/ // 2916
// 2917
/** // 2918
* Creates an array of elements from the specified indexes, or keys, of the // 2919
* `collection`. Indexes may be specified as individual arguments or as arrays // 2920
* of indexes. // 2921
* // 2922
* @static // 2923
* @memberOf _ // 2924
* @category Collections // 2925
* @param {Array|Object|string} collection The collection to iterate over. // 2926
* @param {...(number|number[]|string|string[])} [index] The indexes of `collection` // 2927
* to retrieve, specified as individual indexes or arrays of indexes. // 2928
* @returns {Array} Returns a new array of elements corresponding to the // 2929
* provided indexes. // 2930
* @example // 2931
* // 2932
* _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); // 2933
* // => ['a', 'c', 'e'] // 2934
* // 2935
* _.at(['fred', 'barney', 'pebbles'], 0, 2); // 2936
* // => ['fred', 'pebbles'] // 2937
*/ // 2938
function at(collection) { // 2939
var args = arguments, // 2940
index = -1, // 2941
props = baseFlatten(args, true, false, 1), // 2942
length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length, // 2943
result = Array(length); // 2944
// 2945
while(++index < length) { // 2946
result[index] = collection[props[index]]; // 2947
} // 2948
return result; // 2949
} // 2950
// 2951
/** // 2952
* Checks if a given value is present in a collection using strict equality // 2953
* for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the // 2954
* offset from the end of the collection. // 2955
* // 2956
* @static // 2957
* @memberOf _ // 2958
* @alias include // 2959
* @category Collections // 2960
* @param {Array|Object|string} collection The collection to iterate over. // 2961
* @param {*} target The value to check for. // 2962
* @param {number} [fromIndex=0] The index to search from. // 2963
* @returns {boolean} Returns `true` if the `target` element is found, else `false`. // 2964
* @example // 2965
* // 2966
* _.contains([1, 2, 3], 1); // 2967
* // => true // 2968
* // 2969
* _.contains([1, 2, 3], 1, 2); // 2970
* // => false // 2971
* // 2972
* _.contains({ 'name': 'fred', 'age': 40 }, 'fred'); // 2973
* // => true // 2974
* // 2975
* _.contains('pebbles', 'eb'); // 2976
* // => true // 2977
*/ // 2978
function contains(collection, target, fromIndex) { // 2979
var index = -1, // 2980
indexOf = getIndexOf(), // 2981
length = collection ? collection.length : 0, // 2982
result = false; // 2983
// 2984
fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; // 2985
if (isArray(collection)) { // 2986
result = indexOf(collection, target, fromIndex) > -1; // 2987
} else if (typeof length == 'number') { // 2988
result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1;
} else { // 2990
forOwn(collection, function(value) { // 2991
if (++index >= fromIndex) { // 2992
return !(result = value === target); // 2993
} // 2994
}); // 2995
} // 2996
return result; // 2997
} // 2998
// 2999
/** // 3000
* Creates an object composed of keys generated from the results of running // 3001
* each element of `collection` through the callback. The corresponding value // 3002
* of each key is the number of times the key was returned by the callback. // 3003
* The callback is bound to `thisArg` and invoked with three arguments; // 3004
* (value, index|key, collection). // 3005
* // 3006
* If a property name is provided for `callback` the created "_.pluck" style // 3007
* callback will return the property value of the given element. // 3008
* // 3009
* If an object is provided for `callback` the created "_.where" style callback // 3010
* will return `true` for elements that have the properties of the given object, // 3011
* else `false`. // 3012
* // 3013
* @static // 3014
* @memberOf _ // 3015
* @category Collections // 3016
* @param {Array|Object|string} collection The collection to iterate over. // 3017
* @param {Function|Object|string} [callback=identity] The function called // 3018
* per iteration. If a property name or object is provided it will be used // 3019
* to create a "_.pluck" or "_.where" style callback, respectively. // 3020
* @param {*} [thisArg] The `this` binding of `callback`. // 3021
* @returns {Object} Returns the composed aggregate object. // 3022
* @example // 3023
* // 3024
* _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); // 3025
* // => { '4': 1, '6': 2 } // 3026
* // 3027
* _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); // 3028
* // => { '4': 1, '6': 2 } // 3029
* // 3030
* _.countBy(['one', 'two', 'three'], 'length'); // 3031
* // => { '3': 2, '5': 1 } // 3032
*/ // 3033
var countBy = createAggregator(function(result, value, key) { // 3034
(hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); // 3035
}); // 3036
// 3037
/** // 3038
* Checks if the given callback returns truey value for **all** elements of // 3039
* a collection. The callback is bound to `thisArg` and invoked with three // 3040
* arguments; (value, index|key, collection). // 3041
* // 3042
* If a property name is provided for `callback` the created "_.pluck" style // 3043
* callback will return the property value of the given element. // 3044
* // 3045
* If an object is provided for `callback` the created "_.where" style callback // 3046
* will return `true` for elements that have the properties of the given object, // 3047
* else `false`. // 3048
* // 3049
* @static // 3050
* @memberOf _ // 3051
* @alias all // 3052
* @category Collections // 3053
* @param {Array|Object|string} collection The collection to iterate over. // 3054
* @param {Function|Object|string} [callback=identity] The function called // 3055
* per iteration. If a property name or object is provided it will be used // 3056
* to create a "_.pluck" or "_.where" style callback, respectively. // 3057
* @param {*} [thisArg] The `this` binding of `callback`. // 3058
* @returns {boolean} Returns `true` if all elements passed the callback check, // 3059
* else `false`. // 3060
* @example // 3061
* // 3062
* _.every([true, 1, null, 'yes']); // 3063
* // => false // 3064
* // 3065
* var characters = [ // 3066
* { 'name': 'barney', 'age': 36 }, // 3067
* { 'name': 'fred', 'age': 40 } // 3068
* ]; // 3069
* // 3070
* // using "_.pluck" callback shorthand // 3071
* _.every(characters, 'age'); // 3072
* // => true // 3073
* // 3074
* // using "_.where" callback shorthand // 3075
* _.every(characters, { 'age': 36 }); // 3076
* // => false // 3077
*/ // 3078
function every(collection, callback, thisArg) { // 3079
var result = true; // 3080
callback = lodash.createCallback(callback, thisArg, 3); // 3081
// 3082
var index = -1, // 3083
length = collection ? collection.length : 0; // 3084
// 3085
if (typeof length == 'number') { // 3086
while (++index < length) { // 3087
if (!(result = !!callback(collection[index], index, collection))) { // 3088
break; // 3089
} // 3090
} // 3091
} else { // 3092
forOwn(collection, function(value, index, collection) { // 3093
return (result = !!callback(value, index, collection)); // 3094
}); // 3095
} // 3096
return result; // 3097
} // 3098
// 3099
/** // 3100
* Iterates over elements of a collection, returning an array of all elements // 3101
* the callback returns truey for. The callback is bound to `thisArg` and // 3102
* invoked with three arguments; (value, index|key, collection). // 3103
* // 3104
* If a property name is provided for `callback` the created "_.pluck" style // 3105
* callback will return the property value of the given element. // 3106
* // 3107
* If an object is provided for `callback` the created "_.where" style callback // 3108
* will return `true` for elements that have the properties of the given object, // 3109
* else `false`. // 3110
* // 3111
* @static // 3112
* @memberOf _ // 3113
* @alias select // 3114
* @category Collections // 3115
* @param {Array|Object|string} collection The collection to iterate over. // 3116
* @param {Function|Object|string} [callback=identity] The function called // 3117
* per iteration. If a property name or object is provided it will be used // 3118
* to create a "_.pluck" or "_.where" style callback, respectively. // 3119
* @param {*} [thisArg] The `this` binding of `callback`. // 3120
* @returns {Array} Returns a new array of elements that passed the callback check. // 3121
* @example // 3122
* // 3123
* var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); // 3124
* // => [2, 4, 6] // 3125
* // 3126
* var characters = [ // 3127
* { 'name': 'barney', 'age': 36, 'blocked': false }, // 3128
* { 'name': 'fred', 'age': 40, 'blocked': true } // 3129
* ]; // 3130
* // 3131
* // using "_.pluck" callback shorthand // 3132
* _.filter(characters, 'blocked'); // 3133
* // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] // 3134
* // 3135
* // using "_.where" callback shorthand // 3136
* _.filter(characters, { 'age': 36 }); // 3137
* // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] // 3138
*/ // 3139
function filter(collection, callback, thisArg) { // 3140
var result = []; // 3141
callback = lodash.createCallback(callback, thisArg, 3); // 3142
// 3143
var index = -1, // 3144
length = collection ? collection.length : 0; // 3145
// 3146
if (typeof length == 'number') { // 3147
while (++index < length) { // 3148
var value = collection[index]; // 3149
if (callback(value, index, collection)) { // 3150
result.push(value); // 3151
} // 3152
} // 3153
} else { // 3154
forOwn(collection, function(value, index, collection) { // 3155
if (callback(value, index, collection)) { // 3156
result.push(value); // 3157
} // 3158
}); // 3159
} // 3160
return result; // 3161
} // 3162
// 3163
/** // 3164
* Iterates over elements of a collection, returning the first element that // 3165
* the callback returns truey for. The callback is bound to `thisArg` and // 3166
* invoked with three arguments; (value, index|key, collection). // 3167
* // 3168
* If a property name is provided for `callback` the created "_.pluck" style // 3169
* callback will return the property value of the given element. // 3170
* // 3171
* If an object is provided for `callback` the created "_.where" style callback // 3172
* will return `true` for elements that have the properties of the given object, // 3173
* else `false`. // 3174
* // 3175
* @static // 3176
* @memberOf _ // 3177
* @alias detect, findWhere // 3178
* @category Collections // 3179
* @param {Array|Object|string} collection The collection to iterate over. // 3180
* @param {Function|Object|string} [callback=identity] The function called // 3181
* per iteration. If a property name or object is provided it will be used // 3182
* to create a "_.pluck" or "_.where" style callback, respectively. // 3183
* @param {*} [thisArg] The `this` binding of `callback`. // 3184
* @returns {*} Returns the found element, else `undefined`. // 3185
* @example // 3186
* // 3187
* var characters = [ // 3188
* { 'name': 'barney', 'age': 36, 'blocked': false }, // 3189
* { 'name': 'fred', 'age': 40, 'blocked': true }, // 3190
* { 'name': 'pebbles', 'age': 1, 'blocked': false } // 3191
* ]; // 3192
* // 3193
* _.find(characters, function(chr) { // 3194
* return chr.age < 40; // 3195
* }); // 3196
* // => { 'name': 'barney', 'age': 36, 'blocked': false } // 3197
* // 3198
* // using "_.where" callback shorthand // 3199
* _.find(characters, { 'age': 1 }); // 3200
* // => { 'name': 'pebbles', 'age': 1, 'blocked': false } // 3201
* // 3202
* // using "_.pluck" callback shorthand // 3203
* _.find(characters, 'blocked'); // 3204
* // => { 'name': 'fred', 'age': 40, 'blocked': true } // 3205
*/ // 3206
function find(collection, callback, thisArg) { // 3207
callback = lodash.createCallback(callback, thisArg, 3); // 3208
// 3209
var index = -1, // 3210
length = collection ? collection.length : 0; // 3211
// 3212
if (typeof length == 'number') { // 3213
while (++index < length) { // 3214
var value = collection[index]; // 3215
if (callback(value, index, collection)) { // 3216
return value; // 3217
} // 3218
} // 3219
} else { // 3220
var result; // 3221
forOwn(collection, function(value, index, collection) { // 3222
if (callback(value, index, collection)) { // 3223
result = value; // 3224
return false; // 3225
} // 3226
}); // 3227
return result; // 3228
} // 3229
} // 3230
// 3231
/** // 3232
* This method is like `_.find` except that it iterates over elements // 3233
* of a `collection` from right to left. // 3234
* // 3235
* @static // 3236
* @memberOf _ // 3237
* @category Collections // 3238
* @param {Array|Object|string} collection The collection to iterate over. // 3239
* @param {Function|Object|string} [callback=identity] The function called // 3240
* per iteration. If a property name or object is provided it will be used // 3241
* to create a "_.pluck" or "_.where" style callback, respectively. // 3242
* @param {*} [thisArg] The `this` binding of `callback`. // 3243
* @returns {*} Returns the found element, else `undefined`. // 3244
* @example // 3245
* // 3246
* _.findLast([1, 2, 3, 4], function(num) { // 3247
* return num % 2 == 1; // 3248
* }); // 3249
* // => 3 // 3250
*/ // 3251
function findLast(collection, callback, thisArg) { // 3252
var result; // 3253
callback = lodash.createCallback(callback, thisArg, 3); // 3254
forEachRight(collection, function(value, index, collection) { // 3255
if (callback(value, index, collection)) { // 3256
result = value; // 3257
return false; // 3258
} // 3259
}); // 3260
return result; // 3261
} // 3262
// 3263
/** // 3264
* Iterates over elements of a collection, executing the callback for each // 3265
* element. The callback is bound to `thisArg` and invoked with three arguments; // 3266
* (value, index|key, collection). Callbacks may exit iteration early by // 3267
* explicitly returning `false`. // 3268
* // 3269
* Note: As with other "Collections" methods, objects with a `length` property // 3270
* are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` // 3271
* may be used for object iteration. // 3272
* // 3273
* @static // 3274
* @memberOf _ // 3275
* @alias each // 3276
* @category Collections // 3277
* @param {Array|Object|string} collection The collection to iterate over. // 3278
* @param {Function} [callback=identity] The function called per iteration. // 3279
* @param {*} [thisArg] The `this` binding of `callback`. // 3280
* @returns {Array|Object|string} Returns `collection`. // 3281
* @example // 3282
* // 3283
* _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(','); // 3284
* // => logs each number and returns '1,2,3' // 3285
* // 3286
* _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); // 3287
* // => logs each number and returns the object (property order is not guaranteed across environments) // 3288
*/ // 3289
function forEach(collection, callback, thisArg) { // 3290
var index = -1, // 3291
length = collection ? collection.length : 0; // 3292
// 3293
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); // 3294
if (typeof length == 'number') { // 3295
while (++index < length) { // 3296
if (callback(collection[index], index, collection) === false) { // 3297
break; // 3298
} // 3299
} // 3300
} else { // 3301
forOwn(collection, callback); // 3302
} // 3303
return collection; // 3304
} // 3305
// 3306
/** // 3307
* This method is like `_.forEach` except that it iterates over elements // 3308
* of a `collection` from right to left. // 3309
* // 3310
* @static // 3311
* @memberOf _ // 3312
* @alias eachRight // 3313
* @category Collections // 3314
* @param {Array|Object|string} collection The collection to iterate over. // 3315
* @param {Function} [callback=identity] The function called per iteration. // 3316
* @param {*} [thisArg] The `this` binding of `callback`. // 3317
* @returns {Array|Object|string} Returns `collection`. // 3318
* @example // 3319
* // 3320
* _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); // 3321
* // => logs each number from right to left and returns '3,2,1' // 3322
*/ // 3323
function forEachRight(collection, callback, thisArg) { // 3324
var length = collection ? collection.length : 0; // 3325
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); // 3326
if (typeof length == 'number') { // 3327
while (length--) { // 3328
if (callback(collection[length], length, collection) === false) { // 3329
break; // 3330
} // 3331
} // 3332
} else { // 3333
var props = keys(collection); // 3334
length = props.length; // 3335
forOwn(collection, function(value, key, collection) { // 3336
key = props ? props[--length] : --length; // 3337
return callback(collection[key], key, collection); // 3338
}); // 3339
} // 3340
return collection; // 3341
} // 3342
// 3343
/** // 3344
* Creates an object composed of keys generated from the results of running // 3345
* each element of a collection through the callback. The corresponding value // 3346
* of each key is an array of the elements responsible for generating the key. // 3347
* The callback is bound to `thisArg` and invoked with three arguments; // 3348
* (value, index|key, collection). // 3349
* // 3350
* If a property name is provided for `callback` the created "_.pluck" style // 3351
* callback will return the property value of the given element. // 3352
* // 3353
* If an object is provided for `callback` the created "_.where" style callback // 3354
* will return `true` for elements that have the properties of the given object, // 3355
* else `false` // 3356
* // 3357
* @static // 3358
* @memberOf _ // 3359
* @category Collections // 3360
* @param {Array|Object|string} collection The collection to iterate over. // 3361
* @param {Function|Object|string} [callback=identity] The function called // 3362
* per iteration. If a property name or object is provided it will be used // 3363
* to create a "_.pluck" or "_.where" style callback, respectively. // 3364
* @param {*} [thisArg] The `this` binding of `callback`. // 3365
* @returns {Object} Returns the composed aggregate object. // 3366
* @example // 3367
* // 3368
* _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); // 3369
* // => { '4': [4.2], '6': [6.1, 6.4] } // 3370
* // 3371
* _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); // 3372
* // => { '4': [4.2], '6': [6.1, 6.4] } // 3373
* // 3374
* // using "_.pluck" callback shorthand // 3375
* _.groupBy(['one', 'two', 'three'], 'length'); // 3376
* // => { '3': ['one', 'two'], '5': ['three'] } // 3377
*/ // 3378
var groupBy = createAggregator(function(result, value, key) { // 3379
(hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value); // 3380
}); // 3381
// 3382
/** // 3383
* Creates an object composed of keys generated from the results of running // 3384
* each element of the collection through the given callback. The corresponding // 3385
* value of each key is the last element responsible for generating the key. // 3386
* The callback is bound to `thisArg` and invoked with three arguments; // 3387
* (value, index|key, collection). // 3388
* // 3389
* If a property name is provided for `callback` the created "_.pluck" style // 3390
* callback will return the property value of the given element. // 3391
* // 3392
* If an object is provided for `callback` the created "_.where" style callback // 3393
* will return `true` for elements that have the properties of the given object, // 3394
* else `false`. // 3395
* // 3396
* @static // 3397
* @memberOf _ // 3398
* @category Collections // 3399
* @param {Array|Object|string} collection The collection to iterate over. // 3400
* @param {Function|Object|string} [callback=identity] The function called // 3401
* per iteration. If a property name or object is provided it will be used // 3402
* to create a "_.pluck" or "_.where" style callback, respectively. // 3403
* @param {*} [thisArg] The `this` binding of `callback`. // 3404
* @returns {Object} Returns the composed aggregate object. // 3405
* @example // 3406
* // 3407
* var keys = [ // 3408
* { 'dir': 'left', 'code': 97 }, // 3409
* { 'dir': 'right', 'code': 100 } // 3410
* ]; // 3411
* // 3412
* _.indexBy(keys, 'dir'); // 3413
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } // 3414
* // 3415
* _.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); // 3416
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } // 3417
* // 3418
* _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String); // 3419
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } // 3420
*/ // 3421
var indexBy = createAggregator(function(result, value, key) { // 3422
result[key] = value; // 3423
}); // 3424
// 3425
/** // 3426
* Invokes the method named by `methodName` on each element in the `collection` // 3427
* returning an array of the results of each invoked method. Additional arguments // 3428
* will be provided to each invoked method. If `methodName` is a function it // 3429
* will be invoked for, and `this` bound to, each element in the `collection`. // 3430
* // 3431
* @static // 3432
* @memberOf _ // 3433
* @category Collections // 3434
* @param {Array|Object|string} collection The collection to iterate over. // 3435
* @param {Function|string} methodName The name of the method to invoke or // 3436
* the function invoked per iteration. // 3437
* @param {...*} [arg] Arguments to invoke the method with. // 3438
* @returns {Array} Returns a new array of the results of each invoked method. // 3439
* @example // 3440
* // 3441
* _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); // 3442
* // => [[1, 5, 7], [1, 2, 3]] // 3443
* // 3444
* _.invoke([123, 456], String.prototype.split, ''); // 3445
* // => [['1', '2', '3'], ['4', '5', '6']] // 3446
*/ // 3447
function invoke(collection, methodName) { // 3448
var args = slice(arguments, 2), // 3449
index = -1, // 3450
isFunc = typeof methodName == 'function', // 3451
length = collection ? collection.length : 0, // 3452
result = Array(typeof length == 'number' ? length : 0); // 3453
// 3454
forEach(collection, function(value) { // 3455
result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); // 3456
}); // 3457
return result; // 3458
} // 3459
// 3460
/** // 3461
* Creates an array of values by running each element in the collection // 3462
* through the callback. The callback is bound to `thisArg` and invoked with // 3463
* three arguments; (value, index|key, collection). // 3464
* // 3465
* If a property name is provided for `callback` the created "_.pluck" style // 3466
* callback will return the property value of the given element. // 3467
* // 3468
* If an object is provided for `callback` the created "_.where" style callback // 3469
* will return `true` for elements that have the properties of the given object, // 3470
* else `false`. // 3471
* // 3472
* @static // 3473
* @memberOf _ // 3474
* @alias collect // 3475
* @category Collections // 3476
* @param {Array|Object|string} collection The collection to iterate over. // 3477
* @param {Function|Object|string} [callback=identity] The function called // 3478
* per iteration. If a property name or object is provided it will be used // 3479
* to create a "_.pluck" or "_.where" style callback, respectively. // 3480
* @param {*} [thisArg] The `this` binding of `callback`. // 3481
* @returns {Array} Returns a new array of the results of each `callback` execution. // 3482
* @example // 3483
* // 3484
* _.map([1, 2, 3], function(num) { return num * 3; }); // 3485
* // => [3, 6, 9] // 3486
* // 3487
* _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); // 3488
* // => [3, 6, 9] (property order is not guaranteed across environments) // 3489
* // 3490
* var characters = [ // 3491
* { 'name': 'barney', 'age': 36 }, // 3492
* { 'name': 'fred', 'age': 40 } // 3493
* ]; // 3494
* // 3495
* // using "_.pluck" callback shorthand // 3496
* _.map(characters, 'name'); // 3497
* // => ['barney', 'fred'] // 3498
*/ // 3499
function map(collection, callback, thisArg) { // 3500
var index = -1, // 3501
length = collection ? collection.length : 0; // 3502
// 3503
callback = lodash.createCallback(callback, thisArg, 3); // 3504
if (typeof length == 'number') { // 3505
var result = Array(length); // 3506
while (++index < length) { // 3507
result[index] = callback(collection[index], index, collection); // 3508
} // 3509
} else { // 3510
result = []; // 3511
forOwn(collection, function(value, key, collection) { // 3512
result[++index] = callback(value, key, collection); // 3513
}); // 3514
} // 3515
return result; // 3516
} // 3517
// 3518
/** // 3519
* Retrieves the maximum value of a collection. If the collection is empty or // 3520
* falsey `-Infinity` is returned. If a callback is provided it will be executed // 3521
* for each value in the collection to generate the criterion by which the value // 3522
* is ranked. The callback is bound to `thisArg` and invoked with three // 3523
* arguments; (value, index, collection). // 3524
* // 3525
* If a property name is provided for `callback` the created "_.pluck" style // 3526
* callback will return the property value of the given element. // 3527
* // 3528
* If an object is provided for `callback` the created "_.where" style callback // 3529
* will return `true` for elements that have the properties of the given object, // 3530
* else `false`. // 3531
* // 3532
* @static // 3533
* @memberOf _ // 3534
* @category Collections // 3535
* @param {Array|Object|string} collection The collection to iterate over. // 3536
* @param {Function|Object|string} [callback=identity] The function called // 3537
* per iteration. If a property name or object is provided it will be used // 3538
* to create a "_.pluck" or "_.where" style callback, respectively. // 3539
* @param {*} [thisArg] The `this` binding of `callback`. // 3540
* @returns {*} Returns the maximum value. // 3541
* @example // 3542
* // 3543
* _.max([4, 2, 8, 6]); // 3544
* // => 8 // 3545
* // 3546
* var characters = [ // 3547
* { 'name': 'barney', 'age': 36 }, // 3548
* { 'name': 'fred', 'age': 40 } // 3549
* ]; // 3550
* // 3551
* _.max(characters, function(chr) { return chr.age; }); // 3552
* // => { 'name': 'fred', 'age': 40 }; // 3553
* // 3554
* // using "_.pluck" callback shorthand // 3555
* _.max(characters, 'age'); // 3556
* // => { 'name': 'fred', 'age': 40 }; // 3557
*/ // 3558
function max(collection, callback, thisArg) { // 3559
var computed = -Infinity, // 3560
result = computed; // 3561
// 3562
// allows working with functions like `_.map` without using // 3563
// their `index` argument as a callback // 3564
if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { // 3565
callback = null; // 3566
} // 3567
if (callback == null && isArray(collection)) { // 3568
var index = -1, // 3569
length = collection.length; // 3570
// 3571
while (++index < length) { // 3572
var value = collection[index]; // 3573
if (value > result) { // 3574
result = value; // 3575
} // 3576
} // 3577
} else { // 3578
callback = (callback == null && isString(collection)) // 3579
? charAtCallback // 3580
: lodash.createCallback(callback, thisArg, 3); // 3581
// 3582
forEach(collection, function(value, index, collection) { // 3583
var current = callback(value, index, collection); // 3584
if (current > computed) { // 3585
computed = current; // 3586
result = value; // 3587
} // 3588
}); // 3589
} // 3590
return result; // 3591
} // 3592
// 3593
/** // 3594
* Retrieves the minimum value of a collection. If the collection is empty or // 3595
* falsey `Infinity` is returned. If a callback is provided it will be executed // 3596
* for each value in the collection to generate the criterion by which the value // 3597
* is ranked. The callback is bound to `thisArg` and invoked with three // 3598
* arguments; (value, index, collection). // 3599
* // 3600
* If a property name is provided for `callback` the created "_.pluck" style // 3601
* callback will return the property value of the given element. // 3602
* // 3603
* If an object is provided for `callback` the created "_.where" style callback // 3604
* will return `true` for elements that have the properties of the given object, // 3605
* else `false`. // 3606
* // 3607
* @static // 3608
* @memberOf _ // 3609
* @category Collections // 3610
* @param {Array|Object|string} collection The collection to iterate over. // 3611
* @param {Function|Object|string} [callback=identity] The function called // 3612
* per iteration. If a property name or object is provided it will be used // 3613
* to create a "_.pluck" or "_.where" style callback, respectively. // 3614
* @param {*} [thisArg] The `this` binding of `callback`. // 3615
* @returns {*} Returns the minimum value. // 3616
* @example // 3617
* // 3618
* _.min([4, 2, 8, 6]); // 3619
* // => 2 // 3620
* // 3621
* var characters = [ // 3622
* { 'name': 'barney', 'age': 36 }, // 3623
* { 'name': 'fred', 'age': 40 } // 3624
* ]; // 3625
* // 3626
* _.min(characters, function(chr) { return chr.age; }); // 3627
* // => { 'name': 'barney', 'age': 36 }; // 3628
* // 3629
* // using "_.pluck" callback shorthand // 3630
* _.min(characters, 'age'); // 3631
* // => { 'name': 'barney', 'age': 36 }; // 3632
*/ // 3633
function min(collection, callback, thisArg) { // 3634
var computed = Infinity, // 3635
result = computed; // 3636
// 3637
// allows working with functions like `_.map` without using // 3638
// their `index` argument as a callback // 3639
if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { // 3640
callback = null; // 3641
} // 3642
if (callback == null && isArray(collection)) { // 3643
var index = -1, // 3644
length = collection.length; // 3645
// 3646
while (++index < length) { // 3647
var value = collection[index]; // 3648
if (value < result) { // 3649
result = value; // 3650
} // 3651
} // 3652
} else { // 3653
callback = (callback == null && isString(collection)) // 3654
? charAtCallback // 3655
: lodash.createCallback(callback, thisArg, 3); // 3656
// 3657
forEach(collection, function(value, index, collection) { // 3658
var current = callback(value, index, collection); // 3659
if (current < computed) { // 3660
computed = current; // 3661
result = value; // 3662
} // 3663
}); // 3664
} // 3665
return result; // 3666
} // 3667
// 3668
/** // 3669
* Retrieves the value of a specified property from all elements in the collection. // 3670
* // 3671
* @static // 3672
* @memberOf _ // 3673
* @type Function // 3674
* @category Collections // 3675
* @param {Array|Object|string} collection The collection to iterate over. // 3676
* @param {string} property The name of the property to pluck. // 3677
* @returns {Array} Returns a new array of property values. // 3678
* @example // 3679
* // 3680
* var characters = [ // 3681
* { 'name': 'barney', 'age': 36 }, // 3682
* { 'name': 'fred', 'age': 40 } // 3683
* ]; // 3684
* // 3685
* _.pluck(characters, 'name'); // 3686
* // => ['barney', 'fred'] // 3687
*/ // 3688
var pluck = map; // 3689
// 3690
/** // 3691
* Reduces a collection to a value which is the accumulated result of running // 3692
* each element in the collection through the callback, where each successive // 3693
* callback execution consumes the return value of the previous execution. If // 3694
* `accumulator` is not provided the first element of the collection will be // 3695
* used as the initial `accumulator` value. The callback is bound to `thisArg` // 3696
* and invoked with four arguments; (accumulator, value, index|key, collection). // 3697
* // 3698
* @static // 3699
* @memberOf _ // 3700
* @alias foldl, inject // 3701
* @category Collections // 3702
* @param {Array|Object|string} collection The collection to iterate over. // 3703
* @param {Function} [callback=identity] The function called per iteration. // 3704
* @param {*} [accumulator] Initial value of the accumulator. // 3705
* @param {*} [thisArg] The `this` binding of `callback`. // 3706
* @returns {*} Returns the accumulated value. // 3707
* @example // 3708
* // 3709
* var sum = _.reduce([1, 2, 3], function(sum, num) { // 3710
* return sum + num; // 3711
* }); // 3712
* // => 6 // 3713
* // 3714
* var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { // 3715
* result[key] = num * 3; // 3716
* return result; // 3717
* }, {}); // 3718
* // => { 'a': 3, 'b': 6, 'c': 9 } // 3719
*/ // 3720
function reduce(collection, callback, accumulator, thisArg) { // 3721
if (!collection) return accumulator; // 3722
var noaccum = arguments.length < 3; // 3723
callback = lodash.createCallback(callback, thisArg, 4); // 3724
// 3725
var index = -1, // 3726
length = collection.length; // 3727
// 3728
if (typeof length == 'number') { // 3729
if (noaccum) { // 3730
accumulator = collection[++index]; // 3731
} // 3732
while (++index < length) { // 3733
accumulator = callback(accumulator, collection[index], index, collection); // 3734
} // 3735
} else { // 3736
forOwn(collection, function(value, index, collection) { // 3737
accumulator = noaccum // 3738
? (noaccum = false, value) // 3739
: callback(accumulator, value, index, collection) // 3740
}); // 3741
} // 3742
return accumulator; // 3743
} // 3744
// 3745
/** // 3746
* This method is like `_.reduce` except that it iterates over elements // 3747
* of a `collection` from right to left. // 3748
* // 3749
* @static // 3750
* @memberOf _ // 3751
* @alias foldr // 3752
* @category Collections // 3753
* @param {Array|Object|string} collection The collection to iterate over. // 3754
* @param {Function} [callback=identity] The function called per iteration. // 3755
* @param {*} [accumulator] Initial value of the accumulator. // 3756
* @param {*} [thisArg] The `this` binding of `callback`. // 3757
* @returns {*} Returns the accumulated value. // 3758
* @example // 3759
* // 3760
* var list = [[0, 1], [2, 3], [4, 5]]; // 3761
* var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); // 3762
* // => [4, 5, 2, 3, 0, 1] // 3763
*/ // 3764
function reduceRight(collection, callback, accumulator, thisArg) { // 3765
var noaccum = arguments.length < 3; // 3766
callback = lodash.createCallback(callback, thisArg, 4); // 3767
forEachRight(collection, function(value, index, collection) { // 3768
accumulator = noaccum // 3769
? (noaccum = false, value) // 3770
: callback(accumulator, value, index, collection); // 3771
}); // 3772
return accumulator; // 3773
} // 3774
// 3775
/** // 3776
* The opposite of `_.filter` this method returns the elements of a // 3777
* collection that the callback does **not** return truey for. // 3778
* // 3779
* If a property name is provided for `callback` the created "_.pluck" style // 3780
* callback will return the property value of the given element. // 3781
* // 3782
* If an object is provided for `callback` the created "_.where" style callback // 3783
* will return `true` for elements that have the properties of the given object, // 3784
* else `false`. // 3785
* // 3786
* @static // 3787
* @memberOf _ // 3788
* @category Collections // 3789
* @param {Array|Object|string} collection The collection to iterate over. // 3790
* @param {Function|Object|string} [callback=identity] The function called // 3791
* per iteration. If a property name or object is provided it will be used // 3792
* to create a "_.pluck" or "_.where" style callback, respectively. // 3793
* @param {*} [thisArg] The `this` binding of `callback`. // 3794
* @returns {Array} Returns a new array of elements that failed the callback check. // 3795
* @example // 3796
* // 3797
* var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); // 3798
* // => [1, 3, 5] // 3799
* // 3800
* var characters = [ // 3801
* { 'name': 'barney', 'age': 36, 'blocked': false }, // 3802
* { 'name': 'fred', 'age': 40, 'blocked': true } // 3803
* ]; // 3804
* // 3805
* // using "_.pluck" callback shorthand // 3806
* _.reject(characters, 'blocked'); // 3807
* // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] // 3808
* // 3809
* // using "_.where" callback shorthand // 3810
* _.reject(characters, { 'age': 36 }); // 3811
* // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] // 3812
*/ // 3813
function reject(collection, callback, thisArg) { // 3814
callback = lodash.createCallback(callback, thisArg, 3); // 3815
return filter(collection, function(value, index, collection) { // 3816
return !callback(value, index, collection); // 3817
}); // 3818
} // 3819
// 3820
/** // 3821
* Retrieves a random element or `n` random elements from a collection. // 3822
* // 3823
* @static // 3824
* @memberOf _ // 3825
* @category Collections // 3826
* @param {Array|Object|string} collection The collection to sample. // 3827
* @param {number} [n] The number of elements to sample. // 3828
* @param- {Object} [guard] Allows working with functions like `_.map` // 3829
* without using their `index` arguments as `n`. // 3830
* @returns {Array} Returns the random sample(s) of `collection`. // 3831
* @example // 3832
* // 3833
* _.sample([1, 2, 3, 4]); // 3834
* // => 2 // 3835
* // 3836
* _.sample([1, 2, 3, 4], 2); // 3837
* // => [3, 1] // 3838
*/ // 3839
function sample(collection, n, guard) { // 3840
if (collection && typeof collection.length != 'number') { // 3841
collection = values(collection); // 3842
} // 3843
if (n == null || guard) { // 3844
return collection ? collection[baseRandom(0, collection.length - 1)] : undefined; // 3845
} // 3846
var result = shuffle(collection); // 3847
result.length = nativeMin(nativeMax(0, n), result.length); // 3848
return result; // 3849
} // 3850
// 3851
/** // 3852
* Creates an array of shuffled values, using a version of the Fisher-Yates // 3853
* shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. // 3854
* // 3855
* @static // 3856
* @memberOf _ // 3857
* @category Collections // 3858
* @param {Array|Object|string} collection The collection to shuffle. // 3859
* @returns {Array} Returns a new shuffled collection. // 3860
* @example // 3861
* // 3862
* _.shuffle([1, 2, 3, 4, 5, 6]); // 3863
* // => [4, 1, 6, 3, 5, 2] // 3864
*/ // 3865
function shuffle(collection) { // 3866
var index = -1, // 3867
length = collection ? collection.length : 0, // 3868
result = Array(typeof length == 'number' ? length : 0); // 3869
// 3870
forEach(collection, function(value) { // 3871
var rand = baseRandom(0, ++index); // 3872
result[index] = result[rand]; // 3873
result[rand] = value; // 3874
}); // 3875
return result; // 3876
} // 3877
// 3878
/** // 3879
* Gets the size of the `collection` by returning `collection.length` for arrays // 3880
* and array-like objects or the number of own enumerable properties for objects. // 3881
* // 3882
* @static // 3883
* @memberOf _ // 3884
* @category Collections // 3885
* @param {Array|Object|string} collection The collection to inspect. // 3886
* @returns {number} Returns `collection.length` or number of own enumerable properties. // 3887
* @example // 3888
* // 3889
* _.size([1, 2]); // 3890
* // => 2 // 3891
* // 3892
* _.size({ 'one': 1, 'two': 2, 'three': 3 }); // 3893
* // => 3 // 3894
* // 3895
* _.size('pebbles'); // 3896
* // => 7 // 3897
*/ // 3898
function size(collection) { // 3899
var length = collection ? collection.length : 0; // 3900
return typeof length == 'number' ? length : keys(collection).length; // 3901
} // 3902
// 3903
/** // 3904
* Checks if the callback returns a truey value for **any** element of a // 3905
* collection. The function returns as soon as it finds a passing value and // 3906
* does not iterate over the entire collection. The callback is bound to // 3907
* `thisArg` and invoked with three arguments; (value, index|key, collection). // 3908
* // 3909
* If a property name is provided for `callback` the created "_.pluck" style // 3910
* callback will return the property value of the given element. // 3911
* // 3912
* If an object is provided for `callback` the created "_.where" style callback // 3913
* will return `true` for elements that have the properties of the given object, // 3914
* else `false`. // 3915
* // 3916
* @static // 3917
* @memberOf _ // 3918
* @alias any // 3919
* @category Collections // 3920
* @param {Array|Object|string} collection The collection to iterate over. // 3921
* @param {Function|Object|string} [callback=identity] The function called // 3922
* per iteration. If a property name or object is provided it will be used // 3923
* to create a "_.pluck" or "_.where" style callback, respectively. // 3924
* @param {*} [thisArg] The `this` binding of `callback`. // 3925
* @returns {boolean} Returns `true` if any element passed the callback check, // 3926
* else `false`. // 3927
* @example // 3928
* // 3929
* _.some([null, 0, 'yes', false], Boolean); // 3930
* // => true // 3931
* // 3932
* var characters = [ // 3933
* { 'name': 'barney', 'age': 36, 'blocked': false }, // 3934
* { 'name': 'fred', 'age': 40, 'blocked': true } // 3935
* ]; // 3936
* // 3937
* // using "_.pluck" callback shorthand // 3938
* _.some(characters, 'blocked'); // 3939
* // => true // 3940
* // 3941
* // using "_.where" callback shorthand // 3942
* _.some(characters, { 'age': 1 }); // 3943
* // => false // 3944
*/ // 3945
function some(collection, callback, thisArg) { // 3946
var result; // 3947
callback = lodash.createCallback(callback, thisArg, 3); // 3948
// 3949
var index = -1, // 3950
length = collection ? collection.length : 0; // 3951
// 3952
if (typeof length == 'number') { // 3953
while (++index < length) { // 3954
if ((result = callback(collection[index], index, collection))) { // 3955
break; // 3956
} // 3957
} // 3958
} else { // 3959
forOwn(collection, function(value, index, collection) { // 3960
return !(result = callback(value, index, collection)); // 3961
}); // 3962
} // 3963
return !!result; // 3964
} // 3965
// 3966
/** // 3967
* Creates an array of elements, sorted in ascending order by the results of // 3968
* running each element in a collection through the callback. This method // 3969
* performs a stable sort, that is, it will preserve the original sort order // 3970
* of equal elements. The callback is bound to `thisArg` and invoked with // 3971
* three arguments; (value, index|key, collection). // 3972
* // 3973
* If a property name is provided for `callback` the created "_.pluck" style // 3974
* callback will return the property value of the given element. // 3975
* // 3976
* If an array of property names is provided for `callback` the collection // 3977
* will be sorted by each property value. // 3978
* // 3979
* If an object is provided for `callback` the created "_.where" style callback // 3980
* will return `true` for elements that have the properties of the given object, // 3981
* else `false`. // 3982
* // 3983
* @static // 3984
* @memberOf _ // 3985
* @category Collections // 3986
* @param {Array|Object|string} collection The collection to iterate over. // 3987
* @param {Array|Function|Object|string} [callback=identity] The function called // 3988
* per iteration. If a property name or object is provided it will be used // 3989
* to create a "_.pluck" or "_.where" style callback, respectively. // 3990
* @param {*} [thisArg] The `this` binding of `callback`. // 3991
* @returns {Array} Returns a new array of sorted elements. // 3992
* @example // 3993
* // 3994
* _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); // 3995
* // => [3, 1, 2] // 3996
* // 3997
* _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); // 3998
* // => [3, 1, 2] // 3999
* // 4000
* var characters = [ // 4001
* { 'name': 'barney', 'age': 36 }, // 4002
* { 'name': 'fred', 'age': 40 }, // 4003
* { 'name': 'barney', 'age': 26 }, // 4004
* { 'name': 'fred', 'age': 30 } // 4005
* ]; // 4006
* // 4007
* // using "_.pluck" callback shorthand // 4008
* _.map(_.sortBy(characters, 'age'), _.values); // 4009
* // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]] // 4010
* // 4011
* // sorting by multiple properties // 4012
* _.map(_.sortBy(characters, ['name', 'age']), _.values); // 4013
* // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] // 4014
*/ // 4015
function sortBy(collection, callback, thisArg) { // 4016
var index = -1, // 4017
isArr = isArray(callback), // 4018
length = collection ? collection.length : 0, // 4019
result = Array(typeof length == 'number' ? length : 0); // 4020
// 4021
if (!isArr) { // 4022
callback = lodash.createCallback(callback, thisArg, 3); // 4023
} // 4024
forEach(collection, function(value, key, collection) { // 4025
var object = result[++index] = getObject(); // 4026
if (isArr) { // 4027
object.criteria = map(callback, function(key) { return value[key]; }); // 4028
} else { // 4029
(object.criteria = getArray())[0] = callback(value, key, collection); // 4030
} // 4031
object.index = index; // 4032
object.value = value; // 4033
}); // 4034
// 4035
length = result.length; // 4036
result.sort(compareAscending); // 4037
while (length--) { // 4038
var object = result[length]; // 4039
result[length] = object.value; // 4040
if (!isArr) { // 4041
releaseArray(object.criteria); // 4042
} // 4043
releaseObject(object); // 4044
} // 4045
return result; // 4046
} // 4047
// 4048
/** // 4049
* Converts the `collection` to an array. // 4050
* // 4051
* @static // 4052
* @memberOf _ // 4053
* @category Collections // 4054
* @param {Array|Object|string} collection The collection to convert. // 4055
* @returns {Array} Returns the new converted array. // 4056
* @example // 4057
* // 4058
* (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); // 4059
* // => [2, 3, 4] // 4060
*/ // 4061
function toArray(collection) { // 4062
if (collection && typeof collection.length == 'number') { // 4063
return slice(collection); // 4064
} // 4065
return values(collection); // 4066
} // 4067
// 4068
/** // 4069
* Performs a deep comparison of each element in a `collection` to the given // 4070
* `properties` object, returning an array of all elements that have equivalent // 4071
* property values. // 4072
* // 4073
* @static // 4074
* @memberOf _ // 4075
* @type Function // 4076
* @category Collections // 4077
* @param {Array|Object|string} collection The collection to iterate over. // 4078
* @param {Object} props The object of property values to filter by. // 4079
* @returns {Array} Returns a new array of elements that have the given properties. // 4080
* @example // 4081
* // 4082
* var characters = [ // 4083
* { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }, // 4084
* { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } // 4085
* ]; // 4086
* // 4087
* _.where(characters, { 'age': 36 }); // 4088
* // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }] // 4089
* // 4090
* _.where(characters, { 'pets': ['dino'] }); // 4091
* // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }] // 4092
*/ // 4093
var where = filter; // 4094
// 4095
/*--------------------------------------------------------------------------*/ // 4096
// 4097
/** // 4098
* Creates an array with all falsey values removed. The values `false`, `null`, // 4099
* `0`, `""`, `undefined`, and `NaN` are all falsey. // 4100
* // 4101
* @static // 4102
* @memberOf _ // 4103
* @category Arrays // 4104
* @param {Array} array The array to compact. // 4105
* @returns {Array} Returns a new array of filtered values. // 4106
* @example // 4107
* // 4108
* _.compact([0, 1, false, 2, '', 3]); // 4109
* // => [1, 2, 3] // 4110
*/ // 4111
function compact(array) { // 4112
var index = -1, // 4113
length = array ? array.length : 0, // 4114
result = []; // 4115
// 4116
while (++index < length) { // 4117
var value = array[index]; // 4118
if (value) { // 4119
result.push(value); // 4120
} // 4121
} // 4122
return result; // 4123
} // 4124
// 4125
/** // 4126
* Creates an array excluding all values of the provided arrays using strict // 4127
* equality for comparisons, i.e. `===`. // 4128
* // 4129
* @static // 4130
* @memberOf _ // 4131
* @category Arrays // 4132
* @param {Array} array The array to process. // 4133
* @param {...Array} [values] The arrays of values to exclude. // 4134
* @returns {Array} Returns a new array of filtered values. // 4135
* @example // 4136
* // 4137
* _.difference([1, 2, 3, 4, 5], [5, 2, 10]); // 4138
* // => [1, 3, 4] // 4139
*/ // 4140
function difference(array) { // 4141
return baseDifference(array, baseFlatten(arguments, true, true, 1)); // 4142
} // 4143
// 4144
/** // 4145
* This method is like `_.find` except that it returns the index of the first // 4146
* element that passes the callback check, instead of the element itself. // 4147
* // 4148
* If a property name is provided for `callback` the created "_.pluck" style // 4149
* callback will return the property value of the given element. // 4150
* // 4151
* If an object is provided for `callback` the created "_.where" style callback // 4152
* will return `true` for elements that have the properties of the given object, // 4153
* else `false`. // 4154
* // 4155
* @static // 4156
* @memberOf _ // 4157
* @category Arrays // 4158
* @param {Array} array The array to search. // 4159
* @param {Function|Object|string} [callback=identity] The function called // 4160
* per iteration. If a property name or object is provided it will be used // 4161
* to create a "_.pluck" or "_.where" style callback, respectively. // 4162
* @param {*} [thisArg] The `this` binding of `callback`. // 4163
* @returns {number} Returns the index of the found element, else `-1`. // 4164
* @example // 4165
* // 4166
* var characters = [ // 4167
* { 'name': 'barney', 'age': 36, 'blocked': false }, // 4168
* { 'name': 'fred', 'age': 40, 'blocked': true }, // 4169
* { 'name': 'pebbles', 'age': 1, 'blocked': false } // 4170
* ]; // 4171
* // 4172
* _.findIndex(characters, function(chr) { // 4173
* return chr.age < 20; // 4174
* }); // 4175
* // => 2 // 4176
* // 4177
* // using "_.where" callback shorthand // 4178
* _.findIndex(characters, { 'age': 36 }); // 4179
* // => 0 // 4180
* // 4181
* // using "_.pluck" callback shorthand // 4182
* _.findIndex(characters, 'blocked'); // 4183
* // => 1 // 4184
*/ // 4185
function findIndex(array, callback, thisArg) { // 4186
var index = -1, // 4187
length = array ? array.length : 0; // 4188
// 4189
callback = lodash.createCallback(callback, thisArg, 3); // 4190
while (++index < length) { // 4191
if (callback(array[index], index, array)) { // 4192
return index; // 4193
} // 4194
} // 4195
return -1; // 4196
} // 4197
// 4198
/** // 4199
* This method is like `_.findIndex` except that it iterates over elements // 4200
* of a `collection` from right to left. // 4201
* // 4202
* If a property name is provided for `callback` the created "_.pluck" style // 4203
* callback will return the property value of the given element. // 4204
* // 4205
* If an object is provided for `callback` the created "_.where" style callback // 4206
* will return `true` for elements that have the properties of the given object, // 4207
* else `false`. // 4208
* // 4209
* @static // 4210
* @memberOf _ // 4211
* @category Arrays // 4212
* @param {Array} array The array to search. // 4213
* @param {Function|Object|string} [callback=identity] The function called // 4214
* per iteration. If a property name or object is provided it will be used // 4215
* to create a "_.pluck" or "_.where" style callback, respectively. // 4216
* @param {*} [thisArg] The `this` binding of `callback`. // 4217
* @returns {number} Returns the index of the found element, else `-1`. // 4218
* @example // 4219
* // 4220
* var characters = [ // 4221
* { 'name': 'barney', 'age': 36, 'blocked': true }, // 4222
* { 'name': 'fred', 'age': 40, 'blocked': false }, // 4223
* { 'name': 'pebbles', 'age': 1, 'blocked': true } // 4224
* ]; // 4225
* // 4226
* _.findLastIndex(characters, function(chr) { // 4227
* return chr.age > 30; // 4228
* }); // 4229
* // => 1 // 4230
* // 4231
* // using "_.where" callback shorthand // 4232
* _.findLastIndex(characters, { 'age': 36 }); // 4233
* // => 0 // 4234
* // 4235
* // using "_.pluck" callback shorthand // 4236
* _.findLastIndex(characters, 'blocked'); // 4237
* // => 2 // 4238
*/ // 4239
function findLastIndex(array, callback, thisArg) { // 4240
var length = array ? array.length : 0; // 4241
callback = lodash.createCallback(callback, thisArg, 3); // 4242
while (length--) { // 4243
if (callback(array[length], length, array)) { // 4244
return length; // 4245
} // 4246
} // 4247
return -1; // 4248
} // 4249
// 4250
/** // 4251
* Gets the first element or first `n` elements of an array. If a callback // 4252
* is provided elements at the beginning of the array are returned as long // 4253
* as the callback returns truey. The callback is bound to `thisArg` and // 4254
* invoked with three arguments; (value, index, array). // 4255
* // 4256
* If a property name is provided for `callback` the created "_.pluck" style // 4257
* callback will return the property value of the given element. // 4258
* // 4259
* If an object is provided for `callback` the created "_.where" style callback // 4260
* will return `true` for elements that have the properties of the given object, // 4261
* else `false`. // 4262
* // 4263
* @static // 4264
* @memberOf _ // 4265
* @alias head, take // 4266
* @category Arrays // 4267
* @param {Array} array The array to query. // 4268
* @param {Function|Object|number|string} [callback] The function called // 4269
* per element or the number of elements to return. If a property name or // 4270
* object is provided it will be used to create a "_.pluck" or "_.where" // 4271
* style callback, respectively. // 4272
* @param {*} [thisArg] The `this` binding of `callback`. // 4273
* @returns {*} Returns the first element(s) of `array`. // 4274
* @example // 4275
* // 4276
* _.first([1, 2, 3]); // 4277
* // => 1 // 4278
* // 4279
* _.first([1, 2, 3], 2); // 4280
* // => [1, 2] // 4281
* // 4282
* _.first([1, 2, 3], function(num) { // 4283
* return num < 3; // 4284
* }); // 4285
* // => [1, 2] // 4286
* // 4287
* var characters = [ // 4288
* { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, // 4289
* { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, // 4290
* { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } // 4291
* ]; // 4292
* // 4293
* // using "_.pluck" callback shorthand // 4294
* _.first(characters, 'blocked'); // 4295
* // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }] // 4296
* // 4297
* // using "_.where" callback shorthand // 4298
* _.pluck(_.first(characters, { 'employer': 'slate' }), 'name'); // 4299
* // => ['barney', 'fred'] // 4300
*/ // 4301
function first(array, callback, thisArg) { // 4302
var n = 0, // 4303
length = array ? array.length : 0; // 4304
// 4305
if (typeof callback != 'number' && callback != null) { // 4306
var index = -1; // 4307
callback = lodash.createCallback(callback, thisArg, 3); // 4308
while (++index < length && callback(array[index], index, array)) { // 4309
n++; // 4310
} // 4311
} else { // 4312
n = callback; // 4313
if (n == null || thisArg) { // 4314
return array ? array[0] : undefined; // 4315
} // 4316
} // 4317
return slice(array, 0, nativeMin(nativeMax(0, n), length)); // 4318
} // 4319
// 4320
/** // 4321
* Flattens a nested array (the nesting can be to any depth). If `isShallow` // 4322
* is truey, the array will only be flattened a single level. If a callback // 4323
* is provided each element of the array is passed through the callback before // 4324
* flattening. The callback is bound to `thisArg` and invoked with three // 4325
* arguments; (value, index, array). // 4326
* // 4327
* If a property name is provided for `callback` the created "_.pluck" style // 4328
* callback will return the property value of the given element. // 4329
* // 4330
* If an object is provided for `callback` the created "_.where" style callback // 4331
* will return `true` for elements that have the properties of the given object, // 4332
* else `false`. // 4333
* // 4334
* @static // 4335
* @memberOf _ // 4336
* @category Arrays // 4337
* @param {Array} array The array to flatten. // 4338
* @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. // 4339
* @param {Function|Object|string} [callback=identity] The function called // 4340
* per iteration. If a property name or object is provided it will be used // 4341
* to create a "_.pluck" or "_.where" style callback, respectively. // 4342
* @param {*} [thisArg] The `this` binding of `callback`. // 4343
* @returns {Array} Returns a new flattened array. // 4344
* @example // 4345
* // 4346
* _.flatten([1, [2], [3, [[4]]]]); // 4347
* // => [1, 2, 3, 4]; // 4348
* // 4349
* _.flatten([1, [2], [3, [[4]]]], true); // 4350
* // => [1, 2, 3, [[4]]]; // 4351
* // 4352
* var characters = [ // 4353
* { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] }, // 4354
* { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } // 4355
* ]; // 4356
* // 4357
* // using "_.pluck" callback shorthand // 4358
* _.flatten(characters, 'pets'); // 4359
* // => ['hoppy', 'baby puss', 'dino'] // 4360
*/ // 4361
function flatten(array, isShallow, callback, thisArg) { // 4362
// juggle arguments // 4363
if (typeof isShallow != 'boolean' && isShallow != null) { // 4364
thisArg = callback; // 4365
callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow; // 4366
isShallow = false; // 4367
} // 4368
if (callback != null) { // 4369
array = map(array, callback, thisArg); // 4370
} // 4371
return baseFlatten(array, isShallow); // 4372
} // 4373
// 4374
/** // 4375
* Gets the index at which the first occurrence of `value` is found using // 4376
* strict equality for comparisons, i.e. `===`. If the array is already sorted // 4377
* providing `true` for `fromIndex` will run a faster binary search. // 4378
* // 4379
* @static // 4380
* @memberOf _ // 4381
* @category Arrays // 4382
* @param {Array} array The array to search. // 4383
* @param {*} value The value to search for. // 4384
* @param {boolean|number} [fromIndex=0] The index to search from or `true` // 4385
* to perform a binary search on a sorted array. // 4386
* @returns {number} Returns the index of the matched value or `-1`. // 4387
* @example // 4388
* // 4389
* _.indexOf([1, 2, 3, 1, 2, 3], 2); // 4390
* // => 1 // 4391
* // 4392
* _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); // 4393
* // => 4 // 4394
* // 4395
* _.indexOf([1, 1, 2, 2, 3, 3], 2, true); // 4396
* // => 2 // 4397
*/ // 4398
function indexOf(array, value, fromIndex) { // 4399
if (typeof fromIndex == 'number') { // 4400
var length = array ? array.length : 0; // 4401
fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); // 4402
} else if (fromIndex) { // 4403
var index = sortedIndex(array, value); // 4404
return array[index] === value ? index : -1; // 4405
} // 4406
return baseIndexOf(array, value, fromIndex); // 4407
} // 4408
// 4409
/** // 4410
* Gets all but the last element or last `n` elements of an array. If a // 4411
* callback is provided elements at the end of the array are excluded from // 4412
* the result as long as the callback returns truey. The callback is bound // 4413
* to `thisArg` and invoked with three arguments; (value, index, array). // 4414
* // 4415
* If a property name is provided for `callback` the created "_.pluck" style // 4416
* callback will return the property value of the given element. // 4417
* // 4418
* If an object is provided for `callback` the created "_.where" style callback // 4419
* will return `true` for elements that have the properties of the given object, // 4420
* else `false`. // 4421
* // 4422
* @static // 4423
* @memberOf _ // 4424
* @category Arrays // 4425
* @param {Array} array The array to query. // 4426
* @param {Function|Object|number|string} [callback=1] The function called // 4427
* per element or the number of elements to exclude. If a property name or // 4428
* object is provided it will be used to create a "_.pluck" or "_.where" // 4429
* style callback, respectively. // 4430
* @param {*} [thisArg] The `this` binding of `callback`. // 4431
* @returns {Array} Returns a slice of `array`. // 4432
* @example // 4433
* // 4434
* _.initial([1, 2, 3]); // 4435
* // => [1, 2] // 4436
* // 4437
* _.initial([1, 2, 3], 2); // 4438
* // => [1] // 4439
* // 4440
* _.initial([1, 2, 3], function(num) { // 4441
* return num > 1; // 4442
* }); // 4443
* // => [1] // 4444
* // 4445
* var characters = [ // 4446
* { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, // 4447
* { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, // 4448
* { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } // 4449
* ]; // 4450
* // 4451
* // using "_.pluck" callback shorthand // 4452
* _.initial(characters, 'blocked'); // 4453
* // => [{ 'name': 'barney', 'blocked': false, 'employer': 'slate' }] // 4454
* // 4455
* // using "_.where" callback shorthand // 4456
* _.pluck(_.initial(characters, { 'employer': 'na' }), 'name'); // 4457
* // => ['barney', 'fred'] // 4458
*/ // 4459
function initial(array, callback, thisArg) { // 4460
var n = 0, // 4461
length = array ? array.length : 0; // 4462
// 4463
if (typeof callback != 'number' && callback != null) { // 4464
var index = length; // 4465
callback = lodash.createCallback(callback, thisArg, 3); // 4466
while (index-- && callback(array[index], index, array)) { // 4467
n++; // 4468
} // 4469
} else { // 4470
n = (callback == null || thisArg) ? 1 : callback || n; // 4471
} // 4472
return slice(array, 0, nativeMin(nativeMax(0, length - n), length)); // 4473
} // 4474
// 4475
/** // 4476
* Creates an array of unique values present in all provided arrays using // 4477
* strict equality for comparisons, i.e. `===`. // 4478
* // 4479
* @static // 4480
* @memberOf _ // 4481
* @category Arrays // 4482
* @param {...Array} [array] The arrays to inspect. // 4483
* @returns {Array} Returns an array of shared values. // 4484
* @example // 4485
* // 4486
* _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); // 4487
* // => [1, 2] // 4488
*/ // 4489
function intersection() { // 4490
var args = [], // 4491
argsIndex = -1, // 4492
argsLength = arguments.length, // 4493
caches = getArray(), // 4494
indexOf = getIndexOf(), // 4495
trustIndexOf = indexOf === baseIndexOf, // 4496
seen = getArray(); // 4497
// 4498
while (++argsIndex < argsLength) { // 4499
var value = arguments[argsIndex]; // 4500
if (isArray(value) || isArguments(value)) { // 4501
args.push(value); // 4502
caches.push(trustIndexOf && value.length >= largeArraySize && // 4503
createCache(argsIndex ? args[argsIndex] : seen)); // 4504
} // 4505
} // 4506
var array = args[0], // 4507
index = -1, // 4508
length = array ? array.length : 0, // 4509
result = []; // 4510
// 4511
outer: // 4512
while (++index < length) { // 4513
var cache = caches[0]; // 4514
value = array[index]; // 4515
// 4516
if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { // 4517
argsIndex = argsLength; // 4518
(cache || seen).push(value); // 4519
while (--argsIndex) { // 4520
cache = caches[argsIndex]; // 4521
if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { // 4522
continue outer; // 4523
} // 4524
} // 4525
result.push(value); // 4526
} // 4527
} // 4528
while (argsLength--) { // 4529
cache = caches[argsLength]; // 4530
if (cache) { // 4531
releaseObject(cache); // 4532
} // 4533
} // 4534
releaseArray(caches); // 4535
releaseArray(seen); // 4536
return result; // 4537
} // 4538
// 4539
/** // 4540
* Gets the last element or last `n` elements of an array. If a callback is // 4541
* provided elements at the end of the array are returned as long as the // 4542
* callback returns truey. The callback is bound to `thisArg` and invoked // 4543
* with three arguments; (value, index, array). // 4544
* // 4545
* If a property name is provided for `callback` the created "_.pluck" style // 4546
* callback will return the property value of the given element. // 4547
* // 4548
* If an object is provided for `callback` the created "_.where" style callback // 4549
* will return `true` for elements that have the properties of the given object, // 4550
* else `false`. // 4551
* // 4552
* @static // 4553
* @memberOf _ // 4554
* @category Arrays // 4555
* @param {Array} array The array to query. // 4556
* @param {Function|Object|number|string} [callback] The function called // 4557
* per element or the number of elements to return. If a property name or // 4558
* object is provided it will be used to create a "_.pluck" or "_.where" // 4559
* style callback, respectively. // 4560
* @param {*} [thisArg] The `this` binding of `callback`. // 4561
* @returns {*} Returns the last element(s) of `array`. // 4562
* @example // 4563
* // 4564
* _.last([1, 2, 3]); // 4565
* // => 3 // 4566
* // 4567
* _.last([1, 2, 3], 2); // 4568
* // => [2, 3] // 4569
* // 4570
* _.last([1, 2, 3], function(num) { // 4571
* return num > 1; // 4572
* }); // 4573
* // => [2, 3] // 4574
* // 4575
* var characters = [ // 4576
* { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, // 4577
* { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, // 4578
* { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } // 4579
* ]; // 4580
* // 4581
* // using "_.pluck" callback shorthand // 4582
* _.pluck(_.last(characters, 'blocked'), 'name'); // 4583
* // => ['fred', 'pebbles'] // 4584
* // 4585
* // using "_.where" callback shorthand // 4586
* _.last(characters, { 'employer': 'na' }); // 4587
* // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] // 4588
*/ // 4589
function last(array, callback, thisArg) { // 4590
var n = 0, // 4591
length = array ? array.length : 0; // 4592
// 4593
if (typeof callback != 'number' && callback != null) { // 4594
var index = length; // 4595
callback = lodash.createCallback(callback, thisArg, 3); // 4596
while (index-- && callback(array[index], index, array)) { // 4597
n++; // 4598
} // 4599
} else { // 4600
n = callback; // 4601
if (n == null || thisArg) { // 4602
return array ? array[length - 1] : undefined; // 4603
} // 4604
} // 4605
return slice(array, nativeMax(0, length - n)); // 4606
} // 4607
// 4608
/** // 4609
* Gets the index at which the last occurrence of `value` is found using strict // 4610
* equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used // 4611
* as the offset from the end of the collection. // 4612
* // 4613
* If a property name is provided for `callback` the created "_.pluck" style // 4614
* callback will return the property value of the given element. // 4615
* // 4616
* If an object is provided for `callback` the created "_.where" style callback // 4617
* will return `true` for elements that have the properties of the given object, // 4618
* else `false`. // 4619
* // 4620
* @static // 4621
* @memberOf _ // 4622
* @category Arrays // 4623
* @param {Array} array The array to search. // 4624
* @param {*} value The value to search for. // 4625
* @param {number} [fromIndex=array.length-1] The index to search from. // 4626
* @returns {number} Returns the index of the matched value or `-1`. // 4627
* @example // 4628
* // 4629
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); // 4630
* // => 4 // 4631
* // 4632
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); // 4633
* // => 1 // 4634
*/ // 4635
function lastIndexOf(array, value, fromIndex) { // 4636
var index = array ? array.length : 0; // 4637
if (typeof fromIndex == 'number') { // 4638
index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; // 4639
} // 4640
while (index--) { // 4641
if (array[index] === value) { // 4642
return index; // 4643
} // 4644
} // 4645
return -1; // 4646
} // 4647
// 4648
/** // 4649
* Removes all provided values from the given array using strict equality for // 4650
* comparisons, i.e. `===`. // 4651
* // 4652
* @static // 4653
* @memberOf _ // 4654
* @category Arrays // 4655
* @param {Array} array The array to modify. // 4656
* @param {...*} [value] The values to remove. // 4657
* @returns {Array} Returns `array`. // 4658
* @example // 4659
* // 4660
* var array = [1, 2, 3, 1, 2, 3]; // 4661
* _.pull(array, 2, 3); // 4662
* console.log(array); // 4663
* // => [1, 1] // 4664
*/ // 4665
function pull(array) { // 4666
var args = arguments, // 4667
argsIndex = 0, // 4668
argsLength = args.length, // 4669
length = array ? array.length : 0; // 4670
// 4671
while (++argsIndex < argsLength) { // 4672
var index = -1, // 4673
value = args[argsIndex]; // 4674
while (++index < length) { // 4675
if (array[index] === value) { // 4676
splice.call(array, index--, 1); // 4677
length--; // 4678
} // 4679
} // 4680
} // 4681
return array; // 4682
} // 4683
// 4684
/** // 4685
* Creates an array of numbers (positive and/or negative) progressing from // 4686
* `start` up to but not including `end`. If `start` is less than `stop` a // 4687
* zero-length range is created unless a negative `step` is specified. // 4688
* // 4689
* @static // 4690
* @memberOf _ // 4691
* @category Arrays // 4692
* @param {number} [start=0] The start of the range. // 4693
* @param {number} end The end of the range. // 4694
* @param {number} [step=1] The value to increment or decrement by. // 4695
* @returns {Array} Returns a new range array. // 4696
* @example // 4697
* // 4698
* _.range(4); // 4699
* // => [0, 1, 2, 3] // 4700
* // 4701
* _.range(1, 5); // 4702
* // => [1, 2, 3, 4] // 4703
* // 4704
* _.range(0, 20, 5); // 4705
* // => [0, 5, 10, 15] // 4706
* // 4707
* _.range(0, -4, -1); // 4708
* // => [0, -1, -2, -3] // 4709
* // 4710
* _.range(1, 4, 0); // 4711
* // => [1, 1, 1] // 4712
* // 4713
* _.range(0); // 4714
* // => [] // 4715
*/ // 4716
function range(start, end, step) { // 4717
start = +start || 0; // 4718
step = typeof step == 'number' ? step : (+step || 1); // 4719
// 4720
if (end == null) { // 4721
end = start; // 4722
start = 0; // 4723
} // 4724
// use `Array(length)` so engines like Chakra and V8 avoid slower modes // 4725
// http://youtu.be/XAqIpGU8ZZk#t=17m25s // 4726
var index = -1, // 4727
length = nativeMax(0, ceil((end - start) / (step || 1))), // 4728
result = Array(length); // 4729
// 4730
while (++index < length) { // 4731
result[index] = start; // 4732
start += step; // 4733
} // 4734
return result; // 4735
} // 4736
// 4737
/** // 4738
* Removes all elements from an array that the callback returns truey for // 4739
* and returns an array of removed elements. The callback is bound to `thisArg` // 4740
* and invoked with three arguments; (value, index, array). // 4741
* // 4742
* If a property name is provided for `callback` the created "_.pluck" style // 4743
* callback will return the property value of the given element. // 4744
* // 4745
* If an object is provided for `callback` the created "_.where" style callback // 4746
* will return `true` for elements that have the properties of the given object, // 4747
* else `false`. // 4748
* // 4749
* @static // 4750
* @memberOf _ // 4751
* @category Arrays // 4752
* @param {Array} array The array to modify. // 4753
* @param {Function|Object|string} [callback=identity] The function called // 4754
* per iteration. If a property name or object is provided it will be used // 4755
* to create a "_.pluck" or "_.where" style callback, respectively. // 4756
* @param {*} [thisArg] The `this` binding of `callback`. // 4757
* @returns {Array} Returns a new array of removed elements. // 4758
* @example // 4759
* // 4760
* var array = [1, 2, 3, 4, 5, 6]; // 4761
* var evens = _.remove(array, function(num) { return num % 2 == 0; }); // 4762
* // 4763
* console.log(array); // 4764
* // => [1, 3, 5] // 4765
* // 4766
* console.log(evens); // 4767
* // => [2, 4, 6] // 4768
*/ // 4769
function remove(array, callback, thisArg) { // 4770
var index = -1, // 4771
length = array ? array.length : 0, // 4772
result = []; // 4773
// 4774
callback = lodash.createCallback(callback, thisArg, 3); // 4775
while (++index < length) { // 4776
var value = array[index]; // 4777
if (callback(value, index, array)) { // 4778
result.push(value); // 4779
splice.call(array, index--, 1); // 4780
length--; // 4781
} // 4782
} // 4783
return result; // 4784
} // 4785
// 4786
/** // 4787
* The opposite of `_.initial` this method gets all but the first element or // 4788
* first `n` elements of an array. If a callback function is provided elements // 4789
* at the beginning of the array are excluded from the result as long as the // 4790
* callback returns truey. The callback is bound to `thisArg` and invoked // 4791
* with three arguments; (value, index, array). // 4792
* // 4793
* If a property name is provided for `callback` the created "_.pluck" style // 4794
* callback will return the property value of the given element. // 4795
* // 4796
* If an object is provided for `callback` the created "_.where" style callback // 4797
* will return `true` for elements that have the properties of the given object, // 4798
* else `false`. // 4799
* // 4800
* @static // 4801
* @memberOf _ // 4802
* @alias drop, tail // 4803
* @category Arrays // 4804
* @param {Array} array The array to query. // 4805
* @param {Function|Object|number|string} [callback=1] The function called // 4806
* per element or the number of elements to exclude. If a property name or // 4807
* object is provided it will be used to create a "_.pluck" or "_.where" // 4808
* style callback, respectively. // 4809
* @param {*} [thisArg] The `this` binding of `callback`. // 4810
* @returns {Array} Returns a slice of `array`. // 4811
* @example // 4812
* // 4813
* _.rest([1, 2, 3]); // 4814
* // => [2, 3] // 4815
* // 4816
* _.rest([1, 2, 3], 2); // 4817
* // => [3] // 4818
* // 4819
* _.rest([1, 2, 3], function(num) { // 4820
* return num < 3; // 4821
* }); // 4822
* // => [3] // 4823
* // 4824
* var characters = [ // 4825
* { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, // 4826
* { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, // 4827
* { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } // 4828
* ]; // 4829
* // 4830
* // using "_.pluck" callback shorthand // 4831
* _.pluck(_.rest(characters, 'blocked'), 'name'); // 4832
* // => ['fred', 'pebbles'] // 4833
* // 4834
* // using "_.where" callback shorthand // 4835
* _.rest(characters, { 'employer': 'slate' }); // 4836
* // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] // 4837
*/ // 4838
function rest(array, callback, thisArg) { // 4839
if (typeof callback != 'number' && callback != null) { // 4840
var n = 0, // 4841
index = -1, // 4842
length = array ? array.length : 0; // 4843
// 4844
callback = lodash.createCallback(callback, thisArg, 3); // 4845
while (++index < length && callback(array[index], index, array)) { // 4846
n++; // 4847
} // 4848
} else { // 4849
n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); // 4850
} // 4851
return slice(array, n); // 4852
} // 4853
// 4854
/** // 4855
* Uses a binary search to determine the smallest index at which a value // 4856
* should be inserted into a given sorted array in order to maintain the sort // 4857
* order of the array. If a callback is provided it will be executed for // 4858
* `value` and each element of `array` to compute their sort ranking. The // 4859
* callback is bound to `thisArg` and invoked with one argument; (value). // 4860
* // 4861
* If a property name is provided for `callback` the created "_.pluck" style // 4862
* callback will return the property value of the given element. // 4863
* // 4864
* If an object is provided for `callback` the created "_.where" style callback // 4865
* will return `true` for elements that have the properties of the given object, // 4866
* else `false`. // 4867
* // 4868
* @static // 4869
* @memberOf _ // 4870
* @category Arrays // 4871
* @param {Array} array The array to inspect. // 4872
* @param {*} value The value to evaluate. // 4873
* @param {Function|Object|string} [callback=identity] The function called // 4874
* per iteration. If a property name or object is provided it will be used // 4875
* to create a "_.pluck" or "_.where" style callback, respectively. // 4876
* @param {*} [thisArg] The `this` binding of `callback`. // 4877
* @returns {number} Returns the index at which `value` should be inserted // 4878
* into `array`. // 4879
* @example // 4880
* // 4881
* _.sortedIndex([20, 30, 50], 40); // 4882
* // => 2 // 4883
* // 4884
* // using "_.pluck" callback shorthand // 4885
* _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); // 4886
* // => 2 // 4887
* // 4888
* var dict = { // 4889
* 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } // 4890
* }; // 4891
* // 4892
* _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { // 4893
* return dict.wordToNumber[word]; // 4894
* }); // 4895
* // => 2 // 4896
* // 4897
* _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { // 4898
* return this.wordToNumber[word]; // 4899
* }, dict); // 4900
* // => 2 // 4901
*/ // 4902
function sortedIndex(array, value, callback, thisArg) { // 4903
var low = 0, // 4904
high = array ? array.length : low; // 4905
// 4906
// explicitly reference `identity` for better inlining in Firefox // 4907
callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity; // 4908
value = callback(value); // 4909
// 4910
while (low < high) { // 4911
var mid = (low + high) >>> 1; // 4912
(callback(array[mid]) < value) // 4913
? low = mid + 1 // 4914
: high = mid; // 4915
} // 4916
return low; // 4917
} // 4918
// 4919
/** // 4920
* Creates an array of unique values, in order, of the provided arrays using // 4921
* strict equality for comparisons, i.e. `===`. // 4922
* // 4923
* @static // 4924
* @memberOf _ // 4925
* @category Arrays // 4926
* @param {...Array} [array] The arrays to inspect. // 4927
* @returns {Array} Returns an array of combined values. // 4928
* @example // 4929
* // 4930
* _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]); // 4931
* // => [1, 2, 3, 5, 4] // 4932
*/ // 4933
function union() { // 4934
return baseUniq(baseFlatten(arguments, true, true)); // 4935
} // 4936
// 4937
/** // 4938
* Creates a duplicate-value-free version of an array using strict equality // 4939
* for comparisons, i.e. `===`. If the array is sorted, providing // 4940
* `true` for `isSorted` will use a faster algorithm. If a callback is provided // 4941
* each element of `array` is passed through the callback before uniqueness // 4942
* is computed. The callback is bound to `thisArg` and invoked with three // 4943
* arguments; (value, index, array). // 4944
* // 4945
* If a property name is provided for `callback` the created "_.pluck" style // 4946
* callback will return the property value of the given element. // 4947
* // 4948
* If an object is provided for `callback` the created "_.where" style callback // 4949
* will return `true` for elements that have the properties of the given object, // 4950
* else `false`. // 4951
* // 4952
* @static // 4953
* @memberOf _ // 4954
* @alias unique // 4955
* @category Arrays // 4956
* @param {Array} array The array to process. // 4957
* @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. // 4958
* @param {Function|Object|string} [callback=identity] The function called // 4959
* per iteration. If a property name or object is provided it will be used // 4960
* to create a "_.pluck" or "_.where" style callback, respectively. // 4961
* @param {*} [thisArg] The `this` binding of `callback`. // 4962
* @returns {Array} Returns a duplicate-value-free array. // 4963
* @example // 4964
* // 4965
* _.uniq([1, 2, 1, 3, 1]); // 4966
* // => [1, 2, 3] // 4967
* // 4968
* _.uniq([1, 1, 2, 2, 3], true); // 4969
* // => [1, 2, 3] // 4970
* // 4971
* _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); // 4972
* // => ['A', 'b', 'C'] // 4973
* // 4974
* _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); // 4975
* // => [1, 2.5, 3] // 4976
* // 4977
* // using "_.pluck" callback shorthand // 4978
* _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); // 4979
* // => [{ 'x': 1 }, { 'x': 2 }] // 4980
*/ // 4981
function uniq(array, isSorted, callback, thisArg) { // 4982
// juggle arguments // 4983
if (typeof isSorted != 'boolean' && isSorted != null) { // 4984
thisArg = callback; // 4985
callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted; // 4986
isSorted = false; // 4987
} // 4988
if (callback != null) { // 4989
callback = lodash.createCallback(callback, thisArg, 3); // 4990
} // 4991
return baseUniq(array, isSorted, callback); // 4992
} // 4993
// 4994
/** // 4995
* Creates an array excluding all provided values using strict equality for // 4996
* comparisons, i.e. `===`. // 4997
* // 4998
* @static // 4999
* @memberOf _ // 5000
* @category Arrays // 5001
* @param {Array} array The array to filter. // 5002
* @param {...*} [value] The values to exclude. // 5003
* @returns {Array} Returns a new array of filtered values. // 5004
* @example // 5005
* // 5006
* _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); // 5007
* // => [2, 3, 4] // 5008
*/ // 5009
function without(array) { // 5010
return baseDifference(array, slice(arguments, 1)); // 5011
} // 5012
// 5013
/** // 5014
* Creates an array that is the symmetric difference of the provided arrays. // 5015
* See http://en.wikipedia.org/wiki/Symmetric_difference. // 5016
* // 5017
* @static // 5018
* @memberOf _ // 5019
* @category Arrays // 5020
* @param {...Array} [array] The arrays to inspect. // 5021
* @returns {Array} Returns an array of values. // 5022
* @example // 5023
* // 5024
* _.xor([1, 2, 3], [5, 2, 1, 4]); // 5025
* // => [3, 5, 4] // 5026
* // 5027
* _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]); // 5028
* // => [1, 4, 5] // 5029
*/ // 5030
function xor() { // 5031
var index = -1, // 5032
length = arguments.length; // 5033
// 5034
while (++index < length) { // 5035
var array = arguments[index]; // 5036
if (isArray(array) || isArguments(array)) { // 5037
var result = result // 5038
? baseUniq(baseDifference(result, array).concat(baseDifference(array, result))) // 5039
: array; // 5040
} // 5041
} // 5042
return result || []; // 5043
} // 5044
// 5045
/** // 5046
* Creates an array of grouped elements, the first of which contains the first // 5047
* elements of the given arrays, the second of which contains the second // 5048
* elements of the given arrays, and so on. // 5049
* // 5050
* @static // 5051
* @memberOf _ // 5052
* @alias unzip // 5053
* @category Arrays // 5054
* @param {...Array} [array] Arrays to process. // 5055
* @returns {Array} Returns a new array of grouped elements. // 5056
* @example // 5057
* // 5058
* _.zip(['fred', 'barney'], [30, 40], [true, false]); // 5059
* // => [['fred', 30, true], ['barney', 40, false]] // 5060
*/ // 5061
function zip() { // 5062
var array = arguments.length > 1 ? arguments : arguments[0], // 5063
index = -1, // 5064
length = array ? max(pluck(array, 'length')) : 0, // 5065
result = Array(length < 0 ? 0 : length); // 5066
// 5067
while (++index < length) { // 5068
result[index] = pluck(array, index); // 5069
} // 5070
return result; // 5071
} // 5072
// 5073
/** // 5074
* Creates an object composed from arrays of `keys` and `values`. Provide // 5075
* either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` // 5076
* or two arrays, one of `keys` and one of corresponding `values`. // 5077
* // 5078
* @static // 5079
* @memberOf _ // 5080
* @alias object // 5081
* @category Arrays // 5082
* @param {Array} keys The array of keys. // 5083
* @param {Array} [values=[]] The array of values. // 5084
* @returns {Object} Returns an object composed of the given keys and // 5085
* corresponding values. // 5086
* @example // 5087
* // 5088
* _.zipObject(['fred', 'barney'], [30, 40]); // 5089
* // => { 'fred': 30, 'barney': 40 } // 5090
*/ // 5091
function zipObject(keys, values) { // 5092
var index = -1, // 5093
length = keys ? keys.length : 0, // 5094
result = {}; // 5095
// 5096
if (!values && length && !isArray(keys[0])) { // 5097
values = []; // 5098
} // 5099
while (++index < length) { // 5100
var key = keys[index]; // 5101
if (values) { // 5102
result[key] = values[index]; // 5103
} else if (key) { // 5104
result[key[0]] = key[1]; // 5105
} // 5106
} // 5107
return result; // 5108
} // 5109
// 5110
/*--------------------------------------------------------------------------*/ // 5111
// 5112
/** // 5113
* Creates a function that executes `func`, with the `this` binding and // 5114
* arguments of the created function, only after being called `n` times. // 5115
* // 5116
* @static // 5117
* @memberOf _ // 5118
* @category Functions // 5119
* @param {number} n The number of times the function must be called before // 5120
* `func` is executed. // 5121
* @param {Function} func The function to restrict. // 5122
* @returns {Function} Returns the new restricted function. // 5123
* @example // 5124
* // 5125
* var saves = ['profile', 'settings']; // 5126
* // 5127
* var done = _.after(saves.length, function() { // 5128
* console.log('Done saving!'); // 5129
* }); // 5130
* // 5131
* _.forEach(saves, function(type) { // 5132
* asyncSave({ 'type': type, 'complete': done }); // 5133
* }); // 5134
* // => logs 'Done saving!', after all saves have completed // 5135
*/ // 5136
function after(n, func) { // 5137
if (!isFunction(func)) { // 5138
throw new TypeError; // 5139
} // 5140
return function() { // 5141
if (--n < 1) { // 5142
return func.apply(this, arguments); // 5143
} // 5144
}; // 5145
} // 5146
// 5147
/** // 5148
* Creates a function that, when called, invokes `func` with the `this` // 5149
* binding of `thisArg` and prepends any additional `bind` arguments to those // 5150
* provided to the bound function. // 5151
* // 5152
* @static // 5153
* @memberOf _ // 5154
* @category Functions // 5155
* @param {Function} func The function to bind. // 5156
* @param {*} [thisArg] The `this` binding of `func`. // 5157
* @param {...*} [arg] Arguments to be partially applied. // 5158
* @returns {Function} Returns the new bound function. // 5159
* @example // 5160
* // 5161
* var func = function(greeting) { // 5162
* return greeting + ' ' + this.name; // 5163
* }; // 5164
* // 5165
* func = _.bind(func, { 'name': 'fred' }, 'hi'); // 5166
* func(); // 5167
* // => 'hi fred' // 5168
*/ // 5169
function bind(func, thisArg) { // 5170
return arguments.length > 2 // 5171
? createWrapper(func, 17, slice(arguments, 2), null, thisArg) // 5172
: createWrapper(func, 1, null, null, thisArg); // 5173
} // 5174
// 5175
/** // 5176
* Binds methods of an object to the object itself, overwriting the existing // 5177
* method. Method names may be specified as individual arguments or as arrays // 5178
* of method names. If no method names are provided all the function properties // 5179
* of `object` will be bound. // 5180
* // 5181
* @static // 5182
* @memberOf _ // 5183
* @category Functions // 5184
* @param {Object} object The object to bind and assign the bound methods to. // 5185
* @param {...string} [methodName] The object method names to // 5186
* bind, specified as individual method names or arrays of method names. // 5187
* @returns {Object} Returns `object`. // 5188
* @example // 5189
* // 5190
* var view = { // 5191
* 'label': 'docs', // 5192
* 'onClick': function() { console.log('clicked ' + this.label); } // 5193
* }; // 5194
* // 5195
* _.bindAll(view); // 5196
* jQuery('#docs').on('click', view.onClick); // 5197
* // => logs 'clicked docs', when the button is clicked // 5198
*/ // 5199
function bindAll(object) { // 5200
var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), // 5201
index = -1, // 5202
length = funcs.length; // 5203
// 5204
while (++index < length) { // 5205
var key = funcs[index]; // 5206
object[key] = createWrapper(object[key], 1, null, null, object); // 5207
} // 5208
return object; // 5209
} // 5210
// 5211
/** // 5212
* Creates a function that, when called, invokes the method at `object[key]` // 5213
* and prepends any additional `bindKey` arguments to those provided to the bound // 5214
* function. This method differs from `_.bind` by allowing bound functions to // 5215
* reference methods that will be redefined or don't yet exist. // 5216
* See http://michaux.ca/articles/lazy-function-definition-pattern. // 5217
* // 5218
* @static // 5219
* @memberOf _ // 5220
* @category Functions // 5221
* @param {Object} object The object the method belongs to. // 5222
* @param {string} key The key of the method. // 5223
* @param {...*} [arg] Arguments to be partially applied. // 5224
* @returns {Function} Returns the new bound function. // 5225
* @example // 5226
* // 5227
* var object = { // 5228
* 'name': 'fred', // 5229
* 'greet': function(greeting) { // 5230
* return greeting + ' ' + this.name; // 5231
* } // 5232
* }; // 5233
* // 5234
* var func = _.bindKey(object, 'greet', 'hi'); // 5235
* func(); // 5236
* // => 'hi fred' // 5237
* // 5238
* object.greet = function(greeting) { // 5239
* return greeting + 'ya ' + this.name + '!'; // 5240
* }; // 5241
* // 5242
* func(); // 5243
* // => 'hiya fred!' // 5244
*/ // 5245
function bindKey(object, key) { // 5246
return arguments.length > 2 // 5247
? createWrapper(key, 19, slice(arguments, 2), null, object) // 5248
: createWrapper(key, 3, null, null, object); // 5249
} // 5250
// 5251
/** // 5252
* Creates a function that is the composition of the provided functions, // 5253
* where each function consumes the return value of the function that follows. // 5254
* For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. // 5255
* Each function is executed with the `this` binding of the composed function. // 5256
* // 5257
* @static // 5258
* @memberOf _ // 5259
* @category Functions // 5260
* @param {...Function} [func] Functions to compose. // 5261
* @returns {Function} Returns the new composed function. // 5262
* @example // 5263
* // 5264
* var realNameMap = { // 5265
* 'pebbles': 'penelope' // 5266
* }; // 5267
* // 5268
* var format = function(name) { // 5269
* name = realNameMap[name.toLowerCase()] || name; // 5270
* return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase(); // 5271
* }; // 5272
* // 5273
* var greet = function(formatted) { // 5274
* return 'Hiya ' + formatted + '!'; // 5275
* }; // 5276
* // 5277
* var welcome = _.compose(greet, format); // 5278
* welcome('pebbles'); // 5279
* // => 'Hiya Penelope!' // 5280
*/ // 5281
function compose() { // 5282
var funcs = arguments, // 5283
length = funcs.length; // 5284
// 5285
while (length--) { // 5286
if (!isFunction(funcs[length])) { // 5287
throw new TypeError; // 5288
} // 5289
} // 5290
return function() { // 5291
var args = arguments, // 5292
length = funcs.length; // 5293
// 5294
while (length--) { // 5295
args = [funcs[length].apply(this, args)]; // 5296
} // 5297
return args[0]; // 5298
}; // 5299
} // 5300
// 5301
/** // 5302
* Creates a function which accepts one or more arguments of `func` that when // 5303
* invoked either executes `func` returning its result, if all `func` arguments // 5304
* have been provided, or returns a function that accepts one or more of the // 5305
* remaining `func` arguments, and so on. The arity of `func` can be specified // 5306
* if `func.length` is not sufficient. // 5307
* // 5308
* @static // 5309
* @memberOf _ // 5310
* @category Functions // 5311
* @param {Function} func The function to curry. // 5312
* @param {number} [arity=func.length] The arity of `func`. // 5313
* @returns {Function} Returns the new curried function. // 5314
* @example // 5315
* // 5316
* var curried = _.curry(function(a, b, c) { // 5317
* console.log(a + b + c); // 5318
* }); // 5319
* // 5320
* curried(1)(2)(3); // 5321
* // => 6 // 5322
* // 5323
* curried(1, 2)(3); // 5324
* // => 6 // 5325
* // 5326
* curried(1, 2, 3); // 5327
* // => 6 // 5328
*/ // 5329
function curry(func, arity) { // 5330
arity = typeof arity == 'number' ? arity : (+arity || func.length); // 5331
return createWrapper(func, 4, null, null, null, arity); // 5332
} // 5333
// 5334
/** // 5335
* Creates a function that will delay the execution of `func` until after // 5336
* `wait` milliseconds have elapsed since the last time it was invoked. // 5337
* Provide an options object to indicate that `func` should be invoked on // 5338
* the leading and/or trailing edge of the `wait` timeout. Subsequent calls // 5339
* to the debounced function will return the result of the last `func` call. // 5340
* // 5341
* Note: If `leading` and `trailing` options are `true` `func` will be called // 5342
* on the trailing edge of the timeout only if the the debounced function is // 5343
* invoked more than once during the `wait` timeout. // 5344
* // 5345
* @static // 5346
* @memberOf _ // 5347
* @category Functions // 5348
* @param {Function} func The function to debounce. // 5349
* @param {number} wait The number of milliseconds to delay. // 5350
* @param {Object} [options] The options object. // 5351
* @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout. // 5352
* @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called. // 5353
* @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. // 5354
* @returns {Function} Returns the new debounced function. // 5355
* @example // 5356
* // 5357
* // avoid costly calculations while the window size is in flux // 5358
* var lazyLayout = _.debounce(calculateLayout, 150); // 5359
* jQuery(window).on('resize', lazyLayout); // 5360
* // 5361
* // execute `sendMail` when the click event is fired, debouncing subsequent calls // 5362
* jQuery('#postbox').on('click', _.debounce(sendMail, 300, { // 5363
* 'leading': true, // 5364
* 'trailing': false // 5365
* }); // 5366
* // 5367
* // ensure `batchLog` is executed once after 1 second of debounced calls // 5368
* var source = new EventSource('/stream'); // 5369
* source.addEventListener('message', _.debounce(batchLog, 250, { // 5370
* 'maxWait': 1000 // 5371
* }, false); // 5372
*/ // 5373
function debounce(func, wait, options) { // 5374
var args, // 5375
maxTimeoutId, // 5376
result, // 5377
stamp, // 5378
thisArg, // 5379
timeoutId, // 5380
trailingCall, // 5381
lastCalled = 0, // 5382
maxWait = false, // 5383
trailing = true; // 5384
// 5385
if (!isFunction(func)) { // 5386
throw new TypeError; // 5387
} // 5388
wait = nativeMax(0, wait) || 0; // 5389
if (options === true) { // 5390
var leading = true; // 5391
trailing = false; // 5392
} else if (isObject(options)) { // 5393
leading = options.leading; // 5394
maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); // 5395
trailing = 'trailing' in options ? options.trailing : trailing; // 5396
} // 5397
var delayed = function() { // 5398
var remaining = wait - (now() - stamp); // 5399
if (remaining <= 0) { // 5400
if (maxTimeoutId) { // 5401
clearTimeout(maxTimeoutId); // 5402
} // 5403
var isCalled = trailingCall; // 5404
maxTimeoutId = timeoutId = trailingCall = undefined; // 5405
if (isCalled) { // 5406
lastCalled = now(); // 5407
result = func.apply(thisArg, args); // 5408
if (!timeoutId && !maxTimeoutId) { // 5409
args = thisArg = null; // 5410
} // 5411
} // 5412
} else { // 5413
timeoutId = setTimeout(delayed, remaining); // 5414
} // 5415
}; // 5416
// 5417
var maxDelayed = function() { // 5418
if (timeoutId) { // 5419
clearTimeout(timeoutId); // 5420
} // 5421
maxTimeoutId = timeoutId = trailingCall = undefined; // 5422
if (trailing || (maxWait !== wait)) { // 5423
lastCalled = now(); // 5424
result = func.apply(thisArg, args); // 5425
if (!timeoutId && !maxTimeoutId) { // 5426
args = thisArg = null; // 5427
} // 5428
} // 5429
}; // 5430
// 5431
return function() { // 5432
args = arguments; // 5433
stamp = now(); // 5434
thisArg = this; // 5435
trailingCall = trailing && (timeoutId || !leading); // 5436
// 5437
if (maxWait === false) { // 5438
var leadingCall = leading && !timeoutId; // 5439
} else { // 5440
if (!maxTimeoutId && !leading) { // 5441
lastCalled = stamp; // 5442
} // 5443
var remaining = maxWait - (stamp - lastCalled), // 5444
isCalled = remaining <= 0; // 5445
// 5446
if (isCalled) { // 5447
if (maxTimeoutId) { // 5448
maxTimeoutId = clearTimeout(maxTimeoutId); // 5449
} // 5450
lastCalled = stamp; // 5451
result = func.apply(thisArg, args); // 5452
} // 5453
else if (!maxTimeoutId) { // 5454
maxTimeoutId = setTimeout(maxDelayed, remaining); // 5455
} // 5456
} // 5457
if (isCalled && timeoutId) { // 5458
timeoutId = clearTimeout(timeoutId); // 5459
} // 5460
else if (!timeoutId && wait !== maxWait) { // 5461
timeoutId = setTimeout(delayed, wait); // 5462
} // 5463
if (leadingCall) { // 5464
isCalled = true; // 5465
result = func.apply(thisArg, args); // 5466
} // 5467
if (isCalled && !timeoutId && !maxTimeoutId) { // 5468
args = thisArg = null; // 5469
} // 5470
return result; // 5471
}; // 5472
} // 5473
// 5474
/** // 5475
* Defers executing the `func` function until the current call stack has cleared. // 5476
* Additional arguments will be provided to `func` when it is invoked. // 5477
* // 5478
* @static // 5479
* @memberOf _ // 5480
* @category Functions // 5481
* @param {Function} func The function to defer. // 5482
* @param {...*} [arg] Arguments to invoke the function with. // 5483
* @returns {number} Returns the timer id. // 5484
* @example // 5485
* // 5486
* _.defer(function(text) { console.log(text); }, 'deferred'); // 5487
* // logs 'deferred' after one or more milliseconds // 5488
*/ // 5489
function defer(func) { // 5490
if (!isFunction(func)) { // 5491
throw new TypeError; // 5492
} // 5493
var args = slice(arguments, 1); // 5494
return setTimeout(function() { func.apply(undefined, args); }, 1); // 5495
} // 5496
// 5497
/** // 5498
* Executes the `func` function after `wait` milliseconds. Additional arguments // 5499
* will be provided to `func` when it is invoked. // 5500
* // 5501
* @static // 5502
* @memberOf _ // 5503
* @category Functions // 5504
* @param {Function} func The function to delay. // 5505
* @param {number} wait The number of milliseconds to delay execution. // 5506
* @param {...*} [arg] Arguments to invoke the function with. // 5507
* @returns {number} Returns the timer id. // 5508
* @example // 5509
* // 5510
* _.delay(function(text) { console.log(text); }, 1000, 'later'); // 5511
* // => logs 'later' after one second // 5512
*/ // 5513
function delay(func, wait) { // 5514
if (!isFunction(func)) { // 5515
throw new TypeError; // 5516
} // 5517
var args = slice(arguments, 2); // 5518
return setTimeout(function() { func.apply(undefined, args); }, wait); // 5519
} // 5520
// 5521
/** // 5522
* Creates a function that memoizes the result of `func`. If `resolver` is // 5523
* provided it will be used to determine the cache key for storing the result // 5524
* based on the arguments provided to the memoized function. By default, the // 5525
* first argument provided to the memoized function is used as the cache key. // 5526
* The `func` is executed with the `this` binding of the memoized function. // 5527
* The result cache is exposed as the `cache` property on the memoized function. // 5528
* // 5529
* @static // 5530
* @memberOf _ // 5531
* @category Functions // 5532
* @param {Function} func The function to have its output memoized. // 5533
* @param {Function} [resolver] A function used to resolve the cache key. // 5534
* @returns {Function} Returns the new memoizing function. // 5535
* @example // 5536
* // 5537
* var fibonacci = _.memoize(function(n) { // 5538
* return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); // 5539
* }); // 5540
* // 5541
* fibonacci(9) // 5542
* // => 34 // 5543
* // 5544
* var data = { // 5545
* 'fred': { 'name': 'fred', 'age': 40 }, // 5546
* 'pebbles': { 'name': 'pebbles', 'age': 1 } // 5547
* }; // 5548
* // 5549
* // modifying the result cache // 5550
* var get = _.memoize(function(name) { return data[name]; }, _.identity); // 5551
* get('pebbles'); // 5552
* // => { 'name': 'pebbles', 'age': 1 } // 5553
* // 5554
* get.cache.pebbles.name = 'penelope'; // 5555
* get('pebbles'); // 5556
* // => { 'name': 'penelope', 'age': 1 } // 5557
*/ // 5558
function memoize(func, resolver) { // 5559
if (!isFunction(func)) { // 5560
throw new TypeError; // 5561
} // 5562
var memoized = function() { // 5563
var cache = memoized.cache, // 5564
key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; // 5565
// 5566
return hasOwnProperty.call(cache, key) // 5567
? cache[key] // 5568
: (cache[key] = func.apply(this, arguments)); // 5569
} // 5570
memoized.cache = {}; // 5571
return memoized; // 5572
} // 5573
// 5574
/** // 5575
* Creates a function that is restricted to execute `func` once. Repeat calls to // 5576
* the function will return the value of the first call. The `func` is executed // 5577
* with the `this` binding of the created function. // 5578
* // 5579
* @static // 5580
* @memberOf _ // 5581
* @category Functions // 5582
* @param {Function} func The function to restrict. // 5583
* @returns {Function} Returns the new restricted function. // 5584
* @example // 5585
* // 5586
* var initialize = _.once(createApplication); // 5587
* initialize(); // 5588
* initialize(); // 5589
* // `initialize` executes `createApplication` once // 5590
*/ // 5591
function once(func) { // 5592
var ran, // 5593
result; // 5594
// 5595
if (!isFunction(func)) { // 5596
throw new TypeError; // 5597
} // 5598
return function() { // 5599
if (ran) { // 5600
return result; // 5601
} // 5602
ran = true; // 5603
result = func.apply(this, arguments); // 5604
// 5605
// clear the `func` variable so the function may be garbage collected // 5606
func = null; // 5607
return result; // 5608
}; // 5609
} // 5610
// 5611
/** // 5612
* Creates a function that, when called, invokes `func` with any additional // 5613
* `partial` arguments prepended to those provided to the new function. This // 5614
* method is similar to `_.bind` except it does **not** alter the `this` binding. // 5615
* // 5616
* @static // 5617
* @memberOf _ // 5618
* @category Functions // 5619
* @param {Function} func The function to partially apply arguments to. // 5620
* @param {...*} [arg] Arguments to be partially applied. // 5621
* @returns {Function} Returns the new partially applied function. // 5622
* @example // 5623
* // 5624
* var greet = function(greeting, name) { return greeting + ' ' + name; }; // 5625
* var hi = _.partial(greet, 'hi'); // 5626
* hi('fred'); // 5627
* // => 'hi fred' // 5628
*/ // 5629
function partial(func) { // 5630
return createWrapper(func, 16, slice(arguments, 1)); // 5631
} // 5632
// 5633
/** // 5634
* This method is like `_.partial` except that `partial` arguments are // 5635
* appended to those provided to the new function. // 5636
* // 5637
* @static // 5638
* @memberOf _ // 5639
* @category Functions // 5640
* @param {Function} func The function to partially apply arguments to. // 5641
* @param {...*} [arg] Arguments to be partially applied. // 5642
* @returns {Function} Returns the new partially applied function. // 5643
* @example // 5644
* // 5645
* var defaultsDeep = _.partialRight(_.merge, _.defaults); // 5646
* // 5647
* var options = { // 5648
* 'variable': 'data', // 5649
* 'imports': { 'jq': $ } // 5650
* }; // 5651
* // 5652
* defaultsDeep(options, _.templateSettings); // 5653
* // 5654
* options.variable // 5655
* // => 'data' // 5656
* // 5657
* options.imports // 5658
* // => { '_': _, 'jq': $ } // 5659
*/ // 5660
function partialRight(func) { // 5661
return createWrapper(func, 32, null, slice(arguments, 1)); // 5662
} // 5663
// 5664
/** // 5665
* Creates a function that, when executed, will only call the `func` function // 5666
* at most once per every `wait` milliseconds. Provide an options object to // 5667
* indicate that `func` should be invoked on the leading and/or trailing edge // 5668
* of the `wait` timeout. Subsequent calls to the throttled function will // 5669
* return the result of the last `func` call. // 5670
* // 5671
* Note: If `leading` and `trailing` options are `true` `func` will be called // 5672
* on the trailing edge of the timeout only if the the throttled function is // 5673
* invoked more than once during the `wait` timeout. // 5674
* // 5675
* @static // 5676
* @memberOf _ // 5677
* @category Functions // 5678
* @param {Function} func The function to throttle. // 5679
* @param {number} wait The number of milliseconds to throttle executions to. // 5680
* @param {Object} [options] The options object. // 5681
* @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout. // 5682
* @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. // 5683
* @returns {Function} Returns the new throttled function. // 5684
* @example // 5685
* // 5686
* // avoid excessively updating the position while scrolling // 5687
* var throttled = _.throttle(updatePosition, 100); // 5688
* jQuery(window).on('scroll', throttled); // 5689
* // 5690
* // execute `renewToken` when the click event is fired, but not more than once every 5 minutes // 5691
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { // 5692
* 'trailing': false // 5693
* })); // 5694
*/ // 5695
function throttle(func, wait, options) { // 5696
var leading = true, // 5697
trailing = true; // 5698
// 5699
if (!isFunction(func)) { // 5700
throw new TypeError; // 5701
} // 5702
if (options === false) { // 5703
leading = false; // 5704
} else if (isObject(options)) { // 5705
leading = 'leading' in options ? options.leading : leading; // 5706
trailing = 'trailing' in options ? options.trailing : trailing; // 5707
} // 5708
debounceOptions.leading = leading; // 5709
debounceOptions.maxWait = wait; // 5710
debounceOptions.trailing = trailing; // 5711
// 5712
return debounce(func, wait, debounceOptions); // 5713
} // 5714
// 5715
/** // 5716
* Creates a function that provides `value` to the wrapper function as its // 5717
* first argument. Additional arguments provided to the function are appended // 5718
* to those provided to the wrapper function. The wrapper is executed with // 5719
* the `this` binding of the created function. // 5720
* // 5721
* @static // 5722
* @memberOf _ // 5723
* @category Functions // 5724
* @param {*} value The value to wrap. // 5725
* @param {Function} wrapper The wrapper function. // 5726
* @returns {Function} Returns the new function. // 5727
* @example // 5728
* // 5729
* var p = _.wrap(_.escape, function(func, text) { // 5730
* return '<p>' + func(text) + '</p>'; // 5731
* }); // 5732
* // 5733
* p('Fred, Wilma, & Pebbles'); // 5734
* // => '<p>Fred, Wilma, &amp; Pebbles</p>' // 5735
*/ // 5736
function wrap(value, wrapper) { // 5737
return createWrapper(wrapper, 16, [value]); // 5738
} // 5739
// 5740
/*--------------------------------------------------------------------------*/ // 5741
// 5742
/** // 5743
* Creates a function that returns `value`. // 5744
* // 5745
* @static // 5746
* @memberOf _ // 5747
* @category Utilities // 5748
* @param {*} value The value to return from the new function. // 5749
* @returns {Function} Returns the new function. // 5750
* @example // 5751
* // 5752
* var object = { 'name': 'fred' }; // 5753
* var getter = _.constant(object); // 5754
* getter() === object; // 5755
* // => true // 5756
*/ // 5757
function constant(value) { // 5758
return function() { // 5759
return value; // 5760
}; // 5761
} // 5762
// 5763
/** // 5764
* Produces a callback bound to an optional `thisArg`. If `func` is a property // 5765
* name the created callback will return the property value for a given element. // 5766
* If `func` is an object the created callback will return `true` for elements // 5767
* that contain the equivalent object properties, otherwise it will return `false`. // 5768
* // 5769
* @static // 5770
* @memberOf _ // 5771
* @category Utilities // 5772
* @param {*} [func=identity] The value to convert to a callback. // 5773
* @param {*} [thisArg] The `this` binding of the created callback. // 5774
* @param {number} [argCount] The number of arguments the callback accepts. // 5775
* @returns {Function} Returns a callback function. // 5776
* @example // 5777
* // 5778
* var characters = [ // 5779
* { 'name': 'barney', 'age': 36 }, // 5780
* { 'name': 'fred', 'age': 40 } // 5781
* ]; // 5782
* // 5783
* // wrap to create custom callback shorthands // 5784
* _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) { // 5785
* var match = /^(.+?)__([gl]t)(.+)$/.exec(callback); // 5786
* return !match ? func(callback, thisArg) : function(object) { // 5787
* return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; // 5788
* }; // 5789
* }); // 5790
* // 5791
* _.filter(characters, 'age__gt38'); // 5792
* // => [{ 'name': 'fred', 'age': 40 }] // 5793
*/ // 5794
function createCallback(func, thisArg, argCount) { // 5795
var type = typeof func; // 5796
if (func == null || type == 'function') { // 5797
return baseCreateCallback(func, thisArg, argCount); // 5798
} // 5799
// handle "_.pluck" style callback shorthands // 5800
if (type != 'object') { // 5801
return property(func); // 5802
} // 5803
var props = keys(func), // 5804
key = props[0], // 5805
a = func[key]; // 5806
// 5807
// handle "_.where" style callback shorthands // 5808
if (props.length == 1 && a === a && !isObject(a)) { // 5809
// fast path the common case of providing an object with a single // 5810
// property containing a primitive value // 5811
return function(object) { // 5812
var b = object[key]; // 5813
return a === b && (a !== 0 || (1 / a == 1 / b)); // 5814
}; // 5815
} // 5816
return function(object) { // 5817
var length = props.length, // 5818
result = false; // 5819
// 5820
while (length--) { // 5821
if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { // 5822
break; // 5823
} // 5824
} // 5825
return result; // 5826
}; // 5827
} // 5828
// 5829
/** // 5830
* Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their // 5831
* corresponding HTML entities. // 5832
* // 5833
* @static // 5834
* @memberOf _ // 5835
* @category Utilities // 5836
* @param {string} string The string to escape. // 5837
* @returns {string} Returns the escaped string. // 5838
* @example // 5839
* // 5840
* _.escape('Fred, Wilma, & Pebbles'); // 5841
* // => 'Fred, Wilma, &amp; Pebbles' // 5842
*/ // 5843
function escape(string) { // 5844
return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar); // 5845
} // 5846
// 5847
/** // 5848
* This method returns the first argument provided to it. // 5849
* // 5850
* @static // 5851
* @memberOf _ // 5852
* @category Utilities // 5853
* @param {*} value Any value. // 5854
* @returns {*} Returns `value`. // 5855
* @example // 5856
* // 5857
* var object = { 'name': 'fred' }; // 5858
* _.identity(object) === object; // 5859
* // => true // 5860
*/ // 5861
function identity(value) { // 5862
return value; // 5863
} // 5864
// 5865
/** // 5866
* Adds function properties of a source object to the destination object. // 5867
* If `object` is a function methods will be added to its prototype as well. // 5868
* // 5869
* @static // 5870
* @memberOf _ // 5871
* @category Utilities // 5872
* @param {Function|Object} [object=lodash] object The destination object. // 5873
* @param {Object} source The object of functions to add. // 5874
* @param {Object} [options] The options object. // 5875
* @param {boolean} [options.chain=true] Specify whether the functions added are chainable. // 5876
* @example // 5877
* // 5878
* function capitalize(string) { // 5879
* return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); // 5880
* } // 5881
* // 5882
* _.mixin({ 'capitalize': capitalize }); // 5883
* _.capitalize('fred'); // 5884
* // => 'Fred' // 5885
* // 5886
* _('fred').capitalize().value(); // 5887
* // => 'Fred' // 5888
* // 5889
* _.mixin({ 'capitalize': capitalize }, { 'chain': false }); // 5890
* _('fred').capitalize(); // 5891
* // => 'Fred' // 5892
*/ // 5893
function mixin(object, source, options) { // 5894
var chain = true, // 5895
methodNames = source && functions(source); // 5896
// 5897
if (!source || (!options && !methodNames.length)) { // 5898
if (options == null) { // 5899
options = source; // 5900
} // 5901
ctor = lodashWrapper; // 5902
source = object; // 5903
object = lodash; // 5904
methodNames = functions(source); // 5905
} // 5906
if (options === false) { // 5907
chain = false; // 5908
} else if (isObject(options) && 'chain' in options) { // 5909
chain = options.chain; // 5910
} // 5911
var ctor = object, // 5912
isFunc = isFunction(ctor); // 5913
// 5914
forEach(methodNames, function(methodName) { // 5915
var func = object[methodName] = source[methodName]; // 5916
if (isFunc) { // 5917
ctor.prototype[methodName] = function() { // 5918
var chainAll = this.__chain__, // 5919
value = this.__wrapped__, // 5920
args = [value]; // 5921
// 5922
push.apply(args, arguments); // 5923
var result = func.apply(object, args); // 5924
if (chain || chainAll) { // 5925
if (value === result && isObject(result)) { // 5926
return this; // 5927
} // 5928
result = new ctor(result); // 5929
result.__chain__ = chainAll; // 5930
} // 5931
return result; // 5932
}; // 5933
} // 5934
}); // 5935
} // 5936
// 5937
/** // 5938
* Reverts the '_' variable to its previous value and returns a reference to // 5939
* the `lodash` function. // 5940
* // 5941
* @static // 5942
* @memberOf _ // 5943
* @category Utilities // 5944
* @returns {Function} Returns the `lodash` function. // 5945
* @example // 5946
* // 5947
* var lodash = _.noConflict(); // 5948
*/ // 5949
function noConflict() { // 5950
context._ = oldDash; // 5951
return this; // 5952
} // 5953
// 5954
/** // 5955
* A no-operation function. // 5956
* // 5957
* @static // 5958
* @memberOf _ // 5959
* @category Utilities // 5960
* @example // 5961
* // 5962
* var object = { 'name': 'fred' }; // 5963
* _.noop(object) === undefined; // 5964
* // => true // 5965
*/ // 5966
function noop() { // 5967
// no operation performed // 5968
} // 5969
// 5970
/** // 5971
* Gets the number of milliseconds that have elapsed since the Unix epoch // 5972
* (1 January 1970 00:00:00 UTC). // 5973
* // 5974
* @static // 5975
* @memberOf _ // 5976
* @category Utilities // 5977
* @example // 5978
* // 5979
* var stamp = _.now(); // 5980
* _.defer(function() { console.log(_.now() - stamp); }); // 5981
* // => logs the number of milliseconds it took for the deferred function to be called // 5982
*/ // 5983
var now = isNative(now = Date.now) && now || function() { // 5984
return new Date().getTime(); // 5985
}; // 5986
// 5987
/** // 5988
* Converts the given value into an integer of the specified radix. // 5989
* If `radix` is `undefined` or `0` a `radix` of `10` is used unless the // 5990
* `value` is a hexadecimal, in which case a `radix` of `16` is used. // 5991
* // 5992
* Note: This method avoids differences in native ES3 and ES5 `parseInt` // 5993
* implementations. See http://es5.github.io/#E. // 5994
* // 5995
* @static // 5996
* @memberOf _ // 5997
* @category Utilities // 5998
* @param {string} value The value to parse. // 5999
* @param {number} [radix] The radix used to interpret the value to parse. // 6000
* @returns {number} Returns the new integer value. // 6001
* @example // 6002
* // 6003
* _.parseInt('08'); // 6004
* // => 8 // 6005
*/ // 6006
var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { // 6007
// Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt` // 6008
return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); // 6009
}; // 6010
// 6011
/** // 6012
* Creates a "_.pluck" style function, which returns the `key` value of a // 6013
* given object. // 6014
* // 6015
* @static // 6016
* @memberOf _ // 6017
* @category Utilities // 6018
* @param {string} key The name of the property to retrieve. // 6019
* @returns {Function} Returns the new function. // 6020
* @example // 6021
* // 6022
* var characters = [ // 6023
* { 'name': 'fred', 'age': 40 }, // 6024
* { 'name': 'barney', 'age': 36 } // 6025
* ]; // 6026
* // 6027
* var getName = _.property('name'); // 6028
* // 6029
* _.map(characters, getName); // 6030
* // => ['barney', 'fred'] // 6031
* // 6032
* _.sortBy(characters, getName); // 6033
* // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] // 6034
*/ // 6035
function property(key) { // 6036
return function(object) { // 6037
return object[key]; // 6038
}; // 6039
} // 6040
// 6041
/** // 6042
* Produces a random number between `min` and `max` (inclusive). If only one // 6043
* argument is provided a number between `0` and the given number will be // 6044
* returned. If `floating` is truey or either `min` or `max` are floats a // 6045
* floating-point number will be returned instead of an integer. // 6046
* // 6047
* @static // 6048
* @memberOf _ // 6049
* @category Utilities // 6050
* @param {number} [min=0] The minimum possible value. // 6051
* @param {number} [max=1] The maximum possible value. // 6052
* @param {boolean} [floating=false] Specify returning a floating-point number. // 6053
* @returns {number} Returns a random number. // 6054
* @example // 6055
* // 6056
* _.random(0, 5); // 6057
* // => an integer between 0 and 5 // 6058
* // 6059
* _.random(5); // 6060
* // => also an integer between 0 and 5 // 6061
* // 6062
* _.random(5, true); // 6063
* // => a floating-point number between 0 and 5 // 6064
* // 6065
* _.random(1.2, 5.2); // 6066
* // => a floating-point number between 1.2 and 5.2 // 6067
*/ // 6068
function random(min, max, floating) { // 6069
var noMin = min == null, // 6070
noMax = max == null; // 6071
// 6072
if (floating == null) { // 6073
if (typeof min == 'boolean' && noMax) { // 6074
floating = min; // 6075
min = 1; // 6076
} // 6077
else if (!noMax && typeof max == 'boolean') { // 6078
floating = max; // 6079
noMax = true; // 6080
} // 6081
} // 6082
if (noMin && noMax) { // 6083
max = 1; // 6084
} // 6085
min = +min || 0; // 6086
if (noMax) { // 6087
max = min; // 6088
min = 0; // 6089
} else { // 6090
max = +max || 0; // 6091
} // 6092
if (floating || min % 1 || max % 1) { // 6093
var rand = nativeRandom(); // 6094
return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max); // 6095
} // 6096
return baseRandom(min, max); // 6097
} // 6098
// 6099
/** // 6100
* Resolves the value of property `key` on `object`. If `key` is a function // 6101
* it will be invoked with the `this` binding of `object` and its result returned, // 6102
* else the property value is returned. If `object` is falsey then `undefined` // 6103
* is returned. // 6104
* // 6105
* @static // 6106
* @memberOf _ // 6107
* @category Utilities // 6108
* @param {Object} object The object to inspect. // 6109
* @param {string} key The name of the property to resolve. // 6110
* @returns {*} Returns the resolved value. // 6111
* @example // 6112
* // 6113
* var object = { // 6114
* 'cheese': 'crumpets', // 6115
* 'stuff': function() { // 6116
* return 'nonsense'; // 6117
* } // 6118
* }; // 6119
* // 6120
* _.result(object, 'cheese'); // 6121
* // => 'crumpets' // 6122
* // 6123
* _.result(object, 'stuff'); // 6124
* // => 'nonsense' // 6125
*/ // 6126
function result(object, key) { // 6127
if (object) { // 6128
var value = object[key]; // 6129
return isFunction(value) ? object[key]() : value; // 6130
} // 6131
} // 6132
// 6133
/** // 6134
* A micro-templating method that handles arbitrary delimiters, preserves // 6135
* whitespace, and correctly escapes quotes within interpolated code. // 6136
* // 6137
* Note: In the development build, `_.template` utilizes sourceURLs for easier // 6138
* debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl // 6139
* // 6140
* For more information on precompiling templates see: // 6141
* http://lodash.com/custom-builds // 6142
* // 6143
* For more information on Chrome extension sandboxes see: // 6144
* http://developer.chrome.com/stable/extensions/sandboxingEval.html // 6145
* // 6146
* @static // 6147
* @memberOf _ // 6148
* @category Utilities // 6149
* @param {string} text The template text. // 6150
* @param {Object} data The data object used to populate the text. // 6151
* @param {Object} [options] The options object. // 6152
* @param {RegExp} [options.escape] The "escape" delimiter. // 6153
* @param {RegExp} [options.evaluate] The "evaluate" delimiter. // 6154
* @param {Object} [options.imports] An object to import into the template as local variables. // 6155
* @param {RegExp} [options.interpolate] The "interpolate" delimiter. // 6156
* @param {string} [sourceURL] The sourceURL of the template's compiled source. // 6157
* @param {string} [variable] The data object variable name. // 6158
* @returns {Function|string} Returns a compiled function when no `data` object // 6159
* is given, else it returns the interpolated text. // 6160
* @example // 6161
* // 6162
* // using the "interpolate" delimiter to create a compiled template // 6163
* var compiled = _.template('hello <%= name %>'); // 6164
* compiled({ 'name': 'fred' }); // 6165
* // => 'hello fred' // 6166
* // 6167
* // using the "escape" delimiter to escape HTML in data property values // 6168
* _.template('<b><%- value %></b>', { 'value': '<script>' }); // 6169
* // => '<b>&lt;script&gt;</b>' // 6170
* // 6171
* // using the "evaluate" delimiter to generate HTML // 6172
* var list = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>'; // 6173
* _.template(list, { 'people': ['fred', 'barney'] }); // 6174
* // => '<li>fred</li><li>barney</li>' // 6175
* // 6176
* // using the ES6 delimiter as an alternative to the default "interpolate" delimiter // 6177
* _.template('hello ${ name }', { 'name': 'pebbles' }); // 6178
* // => 'hello pebbles' // 6179
* // 6180
* // using the internal `print` function in "evaluate" delimiters // 6181
* _.template('<% print("hello " + name); %>!', { 'name': 'barney' }); // 6182
* // => 'hello barney!' // 6183
* // 6184
* // using a custom template delimiters // 6185
* _.templateSettings = { // 6186
* 'interpolate': /{{([\s\S]+?)}}/g // 6187
* }; // 6188
* // 6189
* _.template('hello {{ name }}!', { 'name': 'mustache' }); // 6190
* // => 'hello mustache!' // 6191
* // 6192
* // using the `imports` option to import jQuery // 6193
* var list = '<% jq.each(people, function(name) { %><li><%- name %></li><% }); %>'; // 6194
* _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } }); // 6195
* // => '<li>fred</li><li>barney</li>' // 6196
* // 6197
* // using the `sourceURL` option to specify a custom sourceURL for the template // 6198
* var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' }); // 6199
* compiled(data); // 6200
* // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector // 6201
* // 6202
* // using the `variable` option to ensure a with-statement isn't used in the compiled template // 6203
* var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' }); // 6204
* compiled.source; // 6205
* // => function(data) { // 6206
* var __t, __p = '', __e = _.escape; // 6207
* __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!'; // 6208
* return __p; // 6209
* } // 6210
* // 6211
* // using the `source` property to inline compiled templates for meaningful // 6212
* // line numbers in error messages and a stack trace // 6213
* fs.writeFileSync(path.join(cwd, 'jst.js'), '\
* var JST = {\
* "main": ' + _.template(mainText).source + '\
* };\
* '); // 6218
*/ // 6219
function template(text, data, options) { // 6220
// based on John Resig's `tmpl` implementation // 6221
// http://ejohn.org/blog/javascript-micro-templating/ // 6222
// and Laura Doktorova's doT.js // 6223
// https://github.com/olado/doT // 6224
var settings = lodash.templateSettings; // 6225
text = String(text || ''); // 6226
// 6227
// avoid missing dependencies when `iteratorTemplate` is not defined // 6228
options = defaults({}, options, settings); // 6229
// 6230
var imports = defaults({}, options.imports, settings.imports), // 6231
importsKeys = keys(imports), // 6232
importsValues = values(imports); // 6233
// 6234
var isEvaluating, // 6235
index = 0, // 6236
interpolate = options.interpolate || reNoMatch, // 6237
source = "__p += '"; // 6238
// 6239
// compile the regexp to match each delimiter // 6240
var reDelimiters = RegExp( // 6241
(options.escape || reNoMatch).source + '|' + // 6242
interpolate.source + '|' + // 6243
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + // 6244
(options.evaluate || reNoMatch).source + '|$' // 6245
, 'g'); // 6246
// 6247
text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
interpolateValue || (interpolateValue = esTemplateValue); // 6249
// 6250
// escape characters that cannot be included in string literals // 6251
source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar); // 6252
// 6253
// replace delimiters with snippets // 6254
if (escapeValue) { // 6255
source += "' +\n__e(" + escapeValue + ") +\n'"; // 6256
} // 6257
if (evaluateValue) { // 6258
isEvaluating = true; // 6259
source += "';\n" + evaluateValue + ";\n__p += '"; // 6260
} // 6261
if (interpolateValue) { // 6262
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; // 6263
} // 6264
index = offset + match.length; // 6265
// 6266
// the JS engine embedded in Adobe products requires returning the `match` // 6267
// string in order to produce the correct `offset` value // 6268
return match; // 6269
}); // 6270
// 6271
source += "';\n"; // 6272
// 6273
// if `variable` is not specified, wrap a with-statement around the generated // 6274
// code to add the data object to the top of the scope chain // 6275
var variable = options.variable, // 6276
hasVariable = variable; // 6277
// 6278
if (!hasVariable) { // 6279
variable = 'obj'; // 6280
source = 'with (' + variable + ') {\n' + source + '\n}\n'; // 6281
} // 6282
// cleanup code by stripping empty strings // 6283
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) // 6284
.replace(reEmptyStringMiddle, '$1') // 6285
.replace(reEmptyStringTrailing, '$1;'); // 6286
// 6287
// frame code as the function body // 6288
source = 'function(' + variable + ') {\n' + // 6289
(hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') + // 6290
"var __t, __p = '', __e = _.escape" + // 6291
(isEvaluating // 6292
? ', __j = Array.prototype.join;\n' + // 6293
"function print() { __p += __j.call(arguments, '') }\n" // 6294
: ';\n' // 6295
) + // 6296
source + // 6297
'return __p\n}'; // 6298
// 6299
// Use a sourceURL for easier debugging. // 6300
// http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl // 6301
var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';
// 6303
try { // 6304
var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues); // 6305
} catch(e) { // 6306
e.source = source; // 6307
throw e; // 6308
} // 6309
if (data) { // 6310
return result(data); // 6311
} // 6312
// provide the compiled function's source by its `toString` method, in // 6313
// supported environments, or the `source` property as a convenience for // 6314
// inlining compiled templates during the build process // 6315
result.source = source; // 6316
return result; // 6317
} // 6318
// 6319
/** // 6320
* Executes the callback `n` times, returning an array of the results // 6321
* of each callback execution. The callback is bound to `thisArg` and invoked // 6322
* with one argument; (index). // 6323
* // 6324
* @static // 6325
* @memberOf _ // 6326
* @category Utilities // 6327
* @param {number} n The number of times to execute the callback. // 6328
* @param {Function} callback The function called per iteration. // 6329
* @param {*} [thisArg] The `this` binding of `callback`. // 6330
* @returns {Array} Returns an array of the results of each `callback` execution. // 6331
* @example // 6332
* // 6333
* var diceRolls = _.times(3, _.partial(_.random, 1, 6)); // 6334
* // => [3, 6, 4] // 6335
* // 6336
* _.times(3, function(n) { mage.castSpell(n); }); // 6337
* // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively // 6338
* // 6339
* _.times(3, function(n) { this.cast(n); }, mage); // 6340
* // => also calls `mage.castSpell(n)` three times // 6341
*/ // 6342
function times(n, callback, thisArg) { // 6343
n = (n = +n) > -1 ? n : 0; // 6344
var index = -1, // 6345
result = Array(n); // 6346
// 6347
callback = baseCreateCallback(callback, thisArg, 1); // 6348
while (++index < n) { // 6349
result[index] = callback(index); // 6350
} // 6351
return result; // 6352
} // 6353
// 6354
/** // 6355
* The inverse of `_.escape` this method converts the HTML entities // 6356
* `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their // 6357
* corresponding characters. // 6358
* // 6359
* @static // 6360
* @memberOf _ // 6361
* @category Utilities // 6362
* @param {string} string The string to unescape. // 6363
* @returns {string} Returns the unescaped string. // 6364
* @example // 6365
* // 6366
* _.unescape('Fred, Barney &amp; Pebbles'); // 6367
* // => 'Fred, Barney & Pebbles' // 6368
*/ // 6369
function unescape(string) { // 6370
return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar); // 6371
} // 6372
// 6373
/** // 6374
* Generates a unique ID. If `prefix` is provided the ID will be appended to it. // 6375
* // 6376
* @static // 6377
* @memberOf _ // 6378
* @category Utilities // 6379
* @param {string} [prefix] The value to prefix the ID with. // 6380
* @returns {string} Returns the unique ID. // 6381
* @example // 6382
* // 6383
* _.uniqueId('contact_'); // 6384
* // => 'contact_104' // 6385
* // 6386
* _.uniqueId(); // 6387
* // => '105' // 6388
*/ // 6389
function uniqueId(prefix) { // 6390
var id = ++idCounter; // 6391
return String(prefix == null ? '' : prefix) + id; // 6392
} // 6393
// 6394
/*--------------------------------------------------------------------------*/ // 6395
// 6396
/** // 6397
* Creates a `lodash` object that wraps the given value with explicit // 6398
* method chaining enabled. // 6399
* // 6400
* @static // 6401
* @memberOf _ // 6402
* @category Chaining // 6403
* @param {*} value The value to wrap. // 6404
* @returns {Object} Returns the wrapper object. // 6405
* @example // 6406
* // 6407
* var characters = [ // 6408
* { 'name': 'barney', 'age': 36 }, // 6409
* { 'name': 'fred', 'age': 40 }, // 6410
* { 'name': 'pebbles', 'age': 1 } // 6411
* ]; // 6412
* // 6413
* var youngest = _.chain(characters) // 6414
* .sortBy('age') // 6415
* .map(function(chr) { return chr.name + ' is ' + chr.age; }) // 6416
* .first() // 6417
* .value(); // 6418
* // => 'pebbles is 1' // 6419
*/ // 6420
function chain(value) { // 6421
value = new lodashWrapper(value); // 6422
value.__chain__ = true; // 6423
return value; // 6424
} // 6425
// 6426
/** // 6427
* Invokes `interceptor` with the `value` as the first argument and then // 6428
* returns `value`. The purpose of this method is to "tap into" a method // 6429
* chain in order to perform operations on intermediate results within // 6430
* the chain. // 6431
* // 6432
* @static // 6433
* @memberOf _ // 6434
* @category Chaining // 6435
* @param {*} value The value to provide to `interceptor`. // 6436
* @param {Function} interceptor The function to invoke. // 6437
* @returns {*} Returns `value`. // 6438
* @example // 6439
* // 6440
* _([1, 2, 3, 4]) // 6441
* .tap(function(array) { array.pop(); }) // 6442
* .reverse() // 6443
* .value(); // 6444
* // => [3, 2, 1] // 6445
*/ // 6446
function tap(value, interceptor) { // 6447
interceptor(value); // 6448
return value; // 6449
} // 6450
// 6451
/** // 6452
* Enables explicit method chaining on the wrapper object. // 6453
* // 6454
* @name chain // 6455
* @memberOf _ // 6456
* @category Chaining // 6457
* @returns {*} Returns the wrapper object. // 6458
* @example // 6459
* // 6460
* var characters = [ // 6461
* { 'name': 'barney', 'age': 36 }, // 6462
* { 'name': 'fred', 'age': 40 } // 6463
* ]; // 6464
* // 6465
* // without explicit chaining // 6466
* _(characters).first(); // 6467
* // => { 'name': 'barney', 'age': 36 } // 6468
* // 6469
* // with explicit chaining // 6470
* _(characters).chain() // 6471
* .first() // 6472
* .pick('age') // 6473
* .value(); // 6474
* // => { 'age': 36 } // 6475
*/ // 6476
function wrapperChain() { // 6477
this.__chain__ = true; // 6478
return this; // 6479
} // 6480
// 6481
/** // 6482
* Produces the `toString` result of the wrapped value. // 6483
* // 6484
* @name toString // 6485
* @memberOf _ // 6486
* @category Chaining // 6487
* @returns {string} Returns the string result. // 6488
* @example // 6489
* // 6490
* _([1, 2, 3]).toString(); // 6491
* // => '1,2,3' // 6492
*/ // 6493
function wrapperToString() { // 6494
return String(this.__wrapped__); // 6495
} // 6496
// 6497
/** // 6498
* Extracts the wrapped value. // 6499
* // 6500
* @name valueOf // 6501
* @memberOf _ // 6502
* @alias value // 6503
* @category Chaining // 6504
* @returns {*} Returns the wrapped value. // 6505
* @example // 6506
* // 6507
* _([1, 2, 3]).valueOf(); // 6508
* // => [1, 2, 3] // 6509
*/ // 6510
function wrapperValueOf() { // 6511
return this.__wrapped__; // 6512
} // 6513
// 6514
/*--------------------------------------------------------------------------*/ // 6515
// 6516
// add functions that return wrapped values when chaining // 6517
lodash.after = after; // 6518
lodash.assign = assign; // 6519
lodash.at = at; // 6520
lodash.bind = bind; // 6521
lodash.bindAll = bindAll; // 6522
lodash.bindKey = bindKey; // 6523
lodash.chain = chain; // 6524
lodash.compact = compact; // 6525
lodash.compose = compose; // 6526
lodash.constant = constant; // 6527
lodash.countBy = countBy; // 6528
lodash.create = create; // 6529
lodash.createCallback = createCallback; // 6530
lodash.curry = curry; // 6531
lodash.debounce = debounce; // 6532
lodash.defaults = defaults; // 6533
lodash.defer = defer; // 6534
lodash.delay = delay; // 6535
lodash.difference = difference; // 6536
lodash.filter = filter; // 6537
lodash.flatten = flatten; // 6538
lodash.forEach = forEach; // 6539
lodash.forEachRight = forEachRight; // 6540
lodash.forIn = forIn; // 6541
lodash.forInRight = forInRight; // 6542
lodash.forOwn = forOwn; // 6543
lodash.forOwnRight = forOwnRight; // 6544
lodash.functions = functions; // 6545
lodash.groupBy = groupBy; // 6546
lodash.indexBy = indexBy; // 6547
lodash.initial = initial; // 6548
lodash.intersection = intersection; // 6549
lodash.invert = invert; // 6550
lodash.invoke = invoke; // 6551
lodash.keys = keys; // 6552
lodash.map = map; // 6553
lodash.mapValues = mapValues; // 6554
lodash.max = max; // 6555
lodash.memoize = memoize; // 6556
lodash.merge = merge; // 6557
lodash.min = min; // 6558
lodash.omit = omit; // 6559
lodash.once = once; // 6560
lodash.pairs = pairs; // 6561
lodash.partial = partial; // 6562
lodash.partialRight = partialRight; // 6563
lodash.pick = pick; // 6564
lodash.pluck = pluck; // 6565
lodash.property = property; // 6566
lodash.pull = pull; // 6567
lodash.range = range; // 6568
lodash.reject = reject; // 6569
lodash.remove = remove; // 6570
lodash.rest = rest; // 6571
lodash.shuffle = shuffle; // 6572
lodash.sortBy = sortBy; // 6573
lodash.tap = tap; // 6574
lodash.throttle = throttle; // 6575
lodash.times = times; // 6576
lodash.toArray = toArray; // 6577
lodash.transform = transform; // 6578
lodash.union = union; // 6579
lodash.uniq = uniq; // 6580
lodash.values = values; // 6581
lodash.where = where; // 6582
lodash.without = without; // 6583
lodash.wrap = wrap; // 6584
lodash.xor = xor; // 6585
lodash.zip = zip; // 6586
lodash.zipObject = zipObject; // 6587
// 6588
// add aliases // 6589
lodash.collect = map; // 6590
lodash.drop = rest; // 6591
lodash.each = forEach; // 6592
lodash.eachRight = forEachRight; // 6593
lodash.extend = assign; // 6594
lodash.methods = functions; // 6595
lodash.object = zipObject; // 6596
lodash.select = filter; // 6597
lodash.tail = rest; // 6598
lodash.unique = uniq; // 6599
lodash.unzip = zip; // 6600
// 6601
// add functions to `lodash.prototype` // 6602
mixin(lodash); // 6603
// 6604
/*--------------------------------------------------------------------------*/ // 6605
// 6606
// add functions that return unwrapped values when chaining // 6607
lodash.clone = clone; // 6608
lodash.cloneDeep = cloneDeep; // 6609
lodash.contains = contains; // 6610
lodash.escape = escape; // 6611
lodash.every = every; // 6612
lodash.find = find; // 6613
lodash.findIndex = findIndex; // 6614
lodash.findKey = findKey; // 6615
lodash.findLast = findLast; // 6616
lodash.findLastIndex = findLastIndex; // 6617
lodash.findLastKey = findLastKey; // 6618
lodash.has = has; // 6619
lodash.identity = identity; // 6620
lodash.indexOf = indexOf; // 6621
lodash.isArguments = isArguments; // 6622
lodash.isArray = isArray; // 6623
lodash.isBoolean = isBoolean; // 6624
lodash.isDate = isDate; // 6625
lodash.isElement = isElement; // 6626
lodash.isEmpty = isEmpty; // 6627
lodash.isEqual = isEqual; // 6628
lodash.isFinite = isFinite; // 6629
lodash.isFunction = isFunction; // 6630
lodash.isNaN = isNaN; // 6631
lodash.isNull = isNull; // 6632
lodash.isNumber = isNumber; // 6633
lodash.isObject = isObject; // 6634
lodash.isPlainObject = isPlainObject; // 6635
lodash.isRegExp = isRegExp; // 6636
lodash.isString = isString; // 6637
lodash.isUndefined = isUndefined; // 6638
lodash.lastIndexOf = lastIndexOf; // 6639
lodash.mixin = mixin; // 6640
lodash.noConflict = noConflict; // 6641
lodash.noop = noop; // 6642
lodash.now = now; // 6643
lodash.parseInt = parseInt; // 6644
lodash.random = random; // 6645
lodash.reduce = reduce; // 6646
lodash.reduceRight = reduceRight; // 6647
lodash.result = result; // 6648
lodash.runInContext = runInContext; // 6649
lodash.size = size; // 6650
lodash.some = some; // 6651
lodash.sortedIndex = sortedIndex; // 6652
lodash.template = template; // 6653
lodash.unescape = unescape; // 6654
lodash.uniqueId = uniqueId; // 6655
// 6656
// add aliases // 6657
lodash.all = every; // 6658
lodash.any = some; // 6659
lodash.detect = find; // 6660
lodash.findWhere = find; // 6661
lodash.foldl = reduce; // 6662
lodash.foldr = reduceRight; // 6663
lodash.include = contains; // 6664
lodash.inject = reduce; // 6665
// 6666
mixin(function() { // 6667
var source = {} // 6668
forOwn(lodash, function(func, methodName) { // 6669
if (!lodash.prototype[methodName]) { // 6670
source[methodName] = func; // 6671
} // 6672
}); // 6673
return source; // 6674
}(), false); // 6675
// 6676
/*--------------------------------------------------------------------------*/ // 6677
// 6678
// add functions capable of returning wrapped and unwrapped values when chaining // 6679
lodash.first = first; // 6680
lodash.last = last; // 6681
lodash.sample = sample; // 6682
// 6683
// add aliases // 6684
lodash.take = first; // 6685
lodash.head = first; // 6686
// 6687
forOwn(lodash, function(func, methodName) { // 6688
var callbackable = methodName !== 'sample'; // 6689
if (!lodash.prototype[methodName]) { // 6690
lodash.prototype[methodName]= function(n, guard) { // 6691
var chainAll = this.__chain__, // 6692
result = func(this.__wrapped__, n, guard); // 6693
// 6694
return !chainAll && (n == null || (guard && !(callbackable && typeof n == 'function'))) // 6695
? result // 6696
: new lodashWrapper(result, chainAll); // 6697
}; // 6698
} // 6699
}); // 6700
// 6701
/*--------------------------------------------------------------------------*/ // 6702
// 6703
/** // 6704
* The semantic version number. // 6705
* // 6706
* @static // 6707
* @memberOf _ // 6708
* @type string // 6709
*/ // 6710
lodash.VERSION = '2.4.1'; // 6711
// 6712
// add "Chaining" functions to the wrapper // 6713
lodash.prototype.chain = wrapperChain; // 6714
lodash.prototype.toString = wrapperToString; // 6715
lodash.prototype.value = wrapperValueOf; // 6716
lodash.prototype.valueOf = wrapperValueOf; // 6717
// 6718
// add `Array` functions that return unwrapped values // 6719
forEach(['join', 'pop', 'shift'], function(methodName) { // 6720
var func = arrayRef[methodName]; // 6721
lodash.prototype[methodName] = function() { // 6722
var chainAll = this.__chain__, // 6723
result = func.apply(this.__wrapped__, arguments); // 6724
// 6725
return chainAll // 6726
? new lodashWrapper(result, chainAll) // 6727
: result; // 6728
}; // 6729
}); // 6730
// 6731
// add `Array` functions that return the existing wrapped value // 6732
forEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { // 6733
var func = arrayRef[methodName]; // 6734
lodash.prototype[methodName] = function() { // 6735
func.apply(this.__wrapped__, arguments); // 6736
return this; // 6737
}; // 6738
}); // 6739
// 6740
// add `Array` functions that return new wrapped values // 6741
forEach(['concat', 'slice', 'splice'], function(methodName) { // 6742
var func = arrayRef[methodName]; // 6743
lodash.prototype[methodName] = function() { // 6744
return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__); // 6745
}; // 6746
}); // 6747
// 6748
return lodash; // 6749
} // 6750
// 6751
/*--------------------------------------------------------------------------*/ // 6752
// 6753
// expose Lo-Dash // 6754
var _ = runInContext(); // 6755
// 6756
// some AMD build optimizers like r.js check for condition patterns like the following: // 6757
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { // 6758
// Expose Lo-Dash to the global object even when an AMD loader is present in // 6759
// case Lo-Dash is loaded with a RequireJS shim config. // 6760
// See http://requirejs.org/docs/api.html#config-shim // 6761
root._ = _; // 6762
// 6763
// define as an anonymous module so, through path mapping, it can be // 6764
// referenced as the "underscore" module // 6765
define(function() { // 6766
return _; // 6767
}); // 6768
} // 6769
// check for `exports` after `define` in case a build optimizer adds an `exports` object // 6770
else if (freeExports && freeModule) { // 6771
// in Node.js or RingoJS // 6772
if (moduleExports) { // 6773
(freeModule.exports = _)._ = _; // 6774
} // 6775
// in Narwhal or Rhino -require // 6776
else { // 6777
freeExports._ = _; // 6778
} // 6779
} // 6780
else { // 6781
// in a browser or Rhino // 6782
root._ = _; // 6783
} // 6784
}.call(this)); // 6785
// 6786
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/acouch:nvd3-recline/nvd3-recline.js //
// This file is in bare mode and is not in its own closure. //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Write your package code here! // 1
// // 2
_ = window._; // 3
var recline = recline || {}; // 5
recline.View = recline.View || {}; // 7
recline.Model = recline.Model || {}; // 8
recline.Backend = recline.Backend || {}; // 9
recline.View.nvd3 = recline.nvd3 || {}; // 10
// 11
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/acouch:nvd3-recline/vendor/lodash.data/src/lodash.data.js //
// This file is in bare mode and is not in its own closure. //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
;(function(){ // 1
'use strict'; // 2
var global = global || window; // 3
_.mixin({ // 4
// 5
/** // 6
* Check if a value is undefined or null. // 7
* @param {[Object]} x value to check. // 8
* @return {[Boolean]} Returns if x is undefined or null // 9
* otherwise returns true. // 10
*/ // 11
truthy: function(x){ // 12
return x != null; // jshint ignore:line // 13
}, // 14
// 15
/** // 16
* Given a collection of objects, it returns consolidate // 17
* report by a specific key. Something like group by in SQL. // 18
* @param {[Array]} coll collection to proccess // 19
* @param {[String]} key to group by // 20
* @return {[Array]} A consolidated version grouped by key. // 21
*/ // 22
reportBy: function(coll, key, fields){ // 23
return _.map(_.groupBy(coll, key), function(records) { // 24
return _.reduce(records, function(acum, record){ // 25
return _.sumFields(acum, record, fields); // 26
}, {}); // 27
}); // 28
}, // 29
// 30
/** // 31
* Given an object, it picks all the keys present in the mappings // 32
* parameter an renames accordingly their values. // 33
* // 34
* @param {[Object]} obj Object from we want to get the keys. // 35
* // 36
* @param {[Object]} mappings Key-value object. Each key in this object // 37
* represent the original key name. On the other hand, each value represent // 38
* the new name. // 39
* // 40
* @param {[Function]} getter Getter function to retrive a value from obj // 41
* param. // 42
* // 43
* @return {[Object]} New brand object with the picked keys. // 44
*/ // 45
pickAs: function(obj, mappings, getter){ // 46
var result = {}, destKey, key; // 47
var keys = _.keys(mappings); // 48
// 49
for (var i = 0, length = keys.length; i < length; i++) { // 50
key = keys[i]; // 51
destKey = (key in mappings)? mappings[key] : key; // 52
result[destKey] = (getter)? getter(obj, key) : obj[key]; // 53
} // 54
return result; // 55
}, // 56
// 57
/** // 58
* Given a collection of object, it tranforms each object using the mappings // 59
* param. This method it's similar to pickAs but for a collection instead an // 60
* object. // 61
* @param {[Array]} coll Collection to transform // 62
* @param {[Object]} mappings Key-value object. Each key in this object // 63
* represent the original key name. On the other hand, each value represent // 64
* the new name. // 65
* @param {[Function]} Getter function to retrive a value from obj // 66
* param. // 67
* @return {[type]} Returns a transformed collection. // 68
*/ // 69
mapAndTransform: function(coll, mappings, getter){ // 70
return _.map(coll, function(obj){ // 71
return _.pickAs(obj, mappings, getter); // 72
}); // 73
}, // 74
// 75
/** // 76
* Sum // 77
* @param {[type]} acum [description] // 78
* @param {[type]} obj [description] // 79
* @return {[type]} [description] // 80
*/ // 81
sumFields: function(acum, obj, fields){ // 82
for(var field in obj){ // 83
if(!_.has(acum, field)) { // 84
acum[field] = obj[field]; // 85
} else if(_.isNumber(obj[field]) && _.inArray(fields, field)){ // 86
acum[field] += obj[field]; // 87
} // 88
} // 89
return acum; // 90
}, // 91
// 92
/** // 93
* [keyToIndex description] // 94
* @param {[type]} coll [description] // 95
* @param {[type]} field [description] // 96
* @param {[type]} start [description] // 97
* @return {[type]} [description] // 98
*/ // 99
keyToIndex: function(coll, field, start){ // 100
start = (!_.truthy(start)) ? start : 0; // 101
return _.map(coll, function(obj, count){ // 102
obj[field] = count + start; // 103
return obj; // 104
}); // 105
}, // 106
// 107
/** // 108
* [deepMerge description] // 109
* @param {[type]} obj1 [description] // 110
* @param {[type]} obj2 [description] // 111
* @return {[type]} [description] // 112
*/ // 113
deepMerge: function(obj1, obj2) { // 114
for (var p in obj2) { // 115
try { // 116
if(obj2[p].constructor === Object) { // 117
obj1[p] = _.deepMerge(obj1[p], obj2[p]); // 118
} else { // 119
obj1[p] = obj2[p]; // 120
} // 121
} catch(e) { // 122
obj1[p] = obj2[p]; // 123
} // 124
} // 125
return obj1; // 126
}, // 127
// 128
/** // 129
* [always description] // 130
* @param {[type]} coll [description] // 131
* @return {[type]} [description] // 132
*/ // 133
always: function(k){ // 134
return function(){ // 135
return k; // 136
}; // 137
}, // 138
// 139
/** // 140
* [inv description] // 141
* @param {[type]} coll [description] // 142
* @return {[type]} [description] // 143
*/ // 144
inv: function(method){ // 145
var args = _.rest(_.toArray(arguments)); // 146
return function(ctrl){ // 147
return _.isFunction(ctrl[method]) && ctrl[method].apply(ctrl, args); // 148
}; // 149
}, // 150
/** // 151
* [cloneJSON description] // 152
* @param {[type]} coll [description] // 153
* @return {[type]} [description] // 154
*/ // 155
cloneJSON: function(obj){ // 156
return JSON.parse(JSON.stringify(obj)); // 157
}, // 158
/** // 159
* [inArray description] // 160
* @param {[type]} coll [description] // 161
* @return {[type]} [description] // 162
*/ // 163
inArray: function(array, item){ // 164
return (_.indexOf(array, item) === -1)? false : true; // 165
}, // 166
validator: function(predicate){ // 167
return function(item){ // 168
if(_.isFunction(predicate)) { // 169
return predicate(item); // 170
} // 171
return false; // 172
}; // 173
}, // 174
validateField: function(coll, field, validator){ // 175
return _.every(coll, function(item){ // 176
return validator(item[field]); // 177
}); // 178
}, // 179
negate: function (predicate) { // 180
return function() { // 181
return !predicate.apply(this, arguments); // 182
}; // 183
}, // 184
cast: function(value){ // 185
var type = _.inferType(value); // 186
if(type === 'undefined') return undefined; // 187
if(type === 'null') return null; // 188
if(type === 'NaN') return NaN; // 189
if(type === 'Array') return value; // 190
if(type === 'Date'){ // 191
return Date.parse(value); // 192
} // 193
// 194
return global[type](value); // 195
}, // 196
inferType:function(value){ // 197
if(_.isUndefined(value)){ // 198
return 'undefined'; // 199
} else if(_.isNull(value)){ // 200
return 'null'; // 201
} else if(_.isDate(value)){ // 202
return 'Date'; // 203
} else if (_.isArray(value)){ // 204
return 'Array'; // 205
} else if(!isNaN(value) && value !== ''){ // 206
return 'Number'; // 207
} else if(value !== '' && !isNaN(Date.parse(value))) { // 208
return 'Date'; // 209
} else if (_.isObject(value)){ // 210
return 'Object'; // 211
} else if (_.isString(value)){ // 212
return 'String'; // 213
} else if (_.isBoolean(value)){ // 214
return 'Boolean'; // 215
} else if (_.isRegExp(value)){ // 216
return 'RegExp'; // 217
} else if (_.isNaN(value)){ // 218
return 'NaN'; // 219
} // 220
}, // 221
iteratee: function(key){ // 222
return function(obj){ // 223
return obj[key]; // 224
}; // 225
}, // 226
instantiate: function(Constructor){ // 227
return function(options){ // 228
return new Constructor(options); // 229
}; // 230
} // 231
}); // 232
})(); // 233
(function () {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// packages/acouch:nvd3-recline/vendor/chosen/chosen.jquery.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
/*! // 1
Chosen, a Select Box Enhancer for jQuery and Prototype // 2
by Patrick Filler for Harvest, http://getharvest.com // 3
// 4
Version 1.3.0 // 5
Full source at https://github.com/harvesthq/chosen // 6
Copyright (c) 2011-2014 Harvest http://getharvest.com // 7
// 8
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md // 9
This file is generated by `grunt build`, do not edit it by hand. // 10
*/ // 11
// 12
(function() { // 13
var $, AbstractChosen, Chosen, SelectParser, _ref, // 14
__hasProp = {}.hasOwnProperty, // 15
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
// 17
SelectParser = (function() { // 18
function SelectParser() { // 19
this.options_index = 0; // 20
this.parsed = []; // 21
} // 22
// 23
SelectParser.prototype.add_node = function(child) { // 24
if (child.nodeName.toUpperCase() === "OPTGROUP") { // 25
return this.add_group(child); // 26
} else { // 27
return this.add_option(child); // 28
} // 29
}; // 30
// 31
SelectParser.prototype.add_group = function(group) { // 32
var group_position, option, _i, _len, _ref, _results; // 33
group_position = this.parsed.length; // 34
this.parsed.push({ // 35
array_index: group_position, // 36
group: true, // 37
label: this.escapeExpression(group.label), // 38
children: 0, // 39
disabled: group.disabled, // 40
classes: group.className // 41
}); // 42
_ref = group.childNodes; // 43
_results = []; // 44
for (_i = 0, _len = _ref.length; _i < _len; _i++) { // 45
option = _ref[_i]; // 46
_results.push(this.add_option(option, group_position, group.disabled)); // 47
} // 48
return _results; // 49
}; // 50
// 51
SelectParser.prototype.add_option = function(option, group_position, group_disabled) { // 52
if (option.nodeName.toUpperCase() === "OPTION") { // 53
if (option.text !== "") { // 54
if (group_position != null) { // 55
this.parsed[group_position].children += 1; // 56
} // 57
this.parsed.push({ // 58
array_index: this.parsed.length, // 59
options_index: this.options_index, // 60
value: option.value, // 61
text: option.text, // 62
html: option.innerHTML, // 63
selected: option.selected, // 64
disabled: group_disabled === true ? group_disabled : option.disabled, // 65
group_array_index: group_position, // 66
classes: option.className, // 67
style: option.style.cssText // 68
}); // 69
} else { // 70
this.parsed.push({ // 71
array_index: this.parsed.length, // 72
options_index: this.options_index, // 73
empty: true // 74
}); // 75
} // 76
return this.options_index += 1; // 77
} // 78
}; // 79
// 80
SelectParser.prototype.escapeExpression = function(text) { // 81
var map, unsafe_chars; // 82
if ((text == null) || text === false) { // 83
return ""; // 84
} // 85
if (!/[\&\<\>\"\'\`]/.test(text)) { // 86
return text; // 87
} // 88
map = { // 89
"<": "&lt;", // 90
">": "&gt;", // 91
'"': "&quot;", // 92
"'": "&#x27;", // 93
"`": "&#x60;" // 94
}; // 95
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g; // 96
return text.replace(unsafe_chars, function(chr) { // 97
return map[chr] || "&amp;"; // 98
}); // 99
}; // 100
// 101
return SelectParser; // 102
// 103
})(); // 104
// 105
SelectParser.select_to_array = function(select) { // 106
var child, parser, _i, _len, _ref; // 107
parser = new SelectParser(); // 108
_ref = select.childNodes; // 109
for (_i = 0, _len = _ref.length; _i < _len; _i++) { // 110
child = _ref[_i]; // 111
parser.add_node(child); // 112
} // 113
return parser.parsed; // 114
}; // 115
// 116
AbstractChosen = (function() { // 117
function AbstractChosen(form_field, options) { // 118
this.form_field = form_field; // 119
this.options = options != null ? options : {}; // 120
if (!AbstractChosen.browser_is_supported()) { // 121
return; // 122
} // 123
this.is_multiple = this.form_field.multiple; // 124
this.set_default_text(); // 125
this.set_default_values(); // 126
this.setup(); // 127
this.set_up_html(); // 128
this.register_observers(); // 129
this.on_ready(); // 130
} // 131
// 132
AbstractChosen.prototype.set_default_values = function() { // 133
var _this = this; // 134
this.click_test_action = function(evt) { // 135
return _this.test_active_click(evt); // 136
}; // 137
this.activate_action = function(evt) { // 138
return _this.activate_field(evt); // 139
}; // 140
this.active_field = false; // 141
this.mouse_on_container = false; // 142
this.results_showing = false; // 143
this.result_highlighted = null; // 144
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
this.disable_search_threshold = this.options.disable_search_threshold || 0; // 146
this.disable_search = this.options.disable_search || false; // 147
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
this.group_search = this.options.group_search != null ? this.options.group_search : true; // 149
this.search_contains = this.options.search_contains || false; // 150
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
this.max_selected_options = this.options.max_selected_options || Infinity; // 152
this.inherit_select_classes = this.options.inherit_select_classes || false; // 153
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
}; // 156
// 157
AbstractChosen.prototype.set_default_text = function() { // 158
if (this.form_field.getAttribute("data-placeholder")) { // 159
this.default_text = this.form_field.getAttribute("data-placeholder"); // 160
} else if (this.is_multiple) { // 161
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
} else { // 163
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
} // 165
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
}; // 167
// 168
AbstractChosen.prototype.mouse_enter = function() { // 169
return this.mouse_on_container = true; // 170
}; // 171
// 172
AbstractChosen.prototype.mouse_leave = function() { // 173
return this.mouse_on_container = false; // 174
}; // 175
// 176
AbstractChosen.prototype.input_focus = function(evt) { // 177
var _this = this; // 178
if (this.is_multiple) { // 179
if (!this.active_field) { // 180
return setTimeout((function() { // 181
return _this.container_mousedown(); // 182
}), 50); // 183
} // 184
} else { // 185
if (!this.active_field) { // 186
return this.activate_field(); // 187
} // 188
} // 189
}; // 190
// 191
AbstractChosen.prototype.input_blur = function(evt) { // 192
var _this = this; // 193
if (!this.mouse_on_container) { // 194
this.active_field = false; // 195
return setTimeout((function() { // 196
return _this.blur_test(); // 197
}), 100); // 198
} // 199
}; // 200
// 201
AbstractChosen.prototype.results_option_build = function(options) { // 202
var content, data, _i, _len, _ref; // 203
content = ''; // 204
_ref = this.results_data; // 205
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment