lodash-rails 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65466937463572ed6cc01088daa13ada4dd3c6ae
4
- data.tar.gz: 3371d3bfc449a68a53034027fed13bbaa4af0c07
3
+ metadata.gz: d98a9353d25d7e239779bd5cce33cf9aa1a814cb
4
+ data.tar.gz: e62b01da2c44a0fc9e521465316d98fdbe16f422
5
5
  SHA512:
6
- metadata.gz: 6ab1afec36e5853e710330452ed00db00f03eb119fb50ce8064ff8ae81871cd092dc2770ef39838571b7ec515fe473ca12380b9c53c9fc2ef72d1eb369248a45
7
- data.tar.gz: 5171e281f3b0616ddce94dc6fe38e67460c609a667165148bdd11b73d49378c3c66c6d7bc88a982da77a8e80f5f1f7675ea374f2087c38aed21277e288f36b49
6
+ metadata.gz: 400a2f5660123fe99db6f580c7b9f6641f16e7b9aba82fb1fcbb474950edb09f68cb732da88b550ac7a757eea5646ad1f5b6a6bc87f1aee99db9aa8257e0d048
7
+ data.tar.gz: 79105a9a3a31f0e4ece5866bf85294d935148c5c2d07c0cda96f07ba8054a5c4f37c40c653a10a43bbb2064aaa7d95a9a8358080edfbd5b2ffc213b911c2884d
data/README.md CHANGED
@@ -18,7 +18,7 @@ Add the necessary library to `app/assets/javascripts/application.js`:
18
18
 
19
19
  ## What's included?
20
20
 
21
- lodash 3.2.0:
21
+ lodash 3.3.0:
22
22
 
23
23
  * lodash.js
24
24
  * lodash.min.js
@@ -1,5 +1,5 @@
1
1
  module LoDash
2
2
  module Rails
3
- VERSION = "3.2.0"
3
+ VERSION = "3.3.0"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * lodash 3.2.0 (Custom Build) <https://lodash.com/>
3
+ * lodash 3.3.0 (Custom Build) <https://lodash.com/>
4
4
  * Build: `lodash modern -o ./lodash.js`
5
5
  * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
6
6
  * Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
@@ -13,7 +13,7 @@
13
13
  var undefined;
14
14
 
15
15
  /** Used as the semantic version number. */
16
- var VERSION = '3.2.0';
16
+ var VERSION = '3.3.0';
17
17
 
18
18
  /** Used to compose bitmasks for wrapper metadata. */
19
19
  var BIND_FLAG = 1,
@@ -326,6 +326,20 @@
326
326
  return -1;
327
327
  }
328
328
 
329
+ /**
330
+ * The base implementation of `_.isFunction` without support for environments
331
+ * with incorrect `typeof` results.
332
+ *
333
+ * @private
334
+ * @param {*} value The value to check.
335
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
336
+ */
337
+ function baseIsFunction(value) {
338
+ // Avoid a Chakra JIT bug in compatibility modes of IE 11.
339
+ // See https://github.com/jashkenas/underscore/issues/1621 for more details.
340
+ return typeof value == 'function' || false;
341
+ }
342
+
329
343
  /**
330
344
  * The base implementation of `_.sortBy` and `_.sortByAll` which uses `comparer`
331
345
  * to define the sort order of `array` and replaces criteria objects with their
@@ -850,11 +864,15 @@
850
864
  * var wrapped = _([1, 2, 3]);
851
865
  *
852
866
  * // returns an unwrapped value
853
- * wrapped.reduce(function(sum, n) { return sum + n; });
867
+ * wrapped.reduce(function(sum, n) {
868
+ * return sum + n;
869
+ * });
854
870
  * // => 6
855
871
  *
856
872
  * // returns a wrapped value
857
- * var squares = wrapped.map(function(n) { return n * n; });
873
+ * var squares = wrapped.map(function(n) {
874
+ * return n * n;
875
+ * });
858
876
  *
859
877
  * _.isArray(squares);
860
878
  * // => false
@@ -874,6 +892,15 @@
874
892
  return new LodashWrapper(value);
875
893
  }
876
894
 
895
+ /**
896
+ * The function whose prototype all chaining wrappers inherit from.
897
+ *
898
+ * @private
899
+ */
900
+ function baseLodash() {
901
+ // No operation performed.
902
+ }
903
+
877
904
  /**
878
905
  * The base constructor for creating `lodash` wrapper objects.
879
906
  *
@@ -2312,7 +2339,7 @@
2312
2339
 
2313
2340
  if (isStrictComparable(value)) {
2314
2341
  return function(object) {
2315
- return object != null && value === object[key] && hasOwnProperty.call(object, key);
2342
+ return object != null && object[key] === value && hasOwnProperty.call(object, key);
2316
2343
  };
2317
2344
  }
2318
2345
  }
@@ -2362,8 +2389,10 @@
2362
2389
  * @returns {Object} Returns the destination object.
2363
2390
  */
2364
2391
  function baseMerge(object, source, customizer, stackA, stackB) {
2392
+ if (!isObject(object)) {
2393
+ return object;
2394
+ }
2365
2395
  var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source));
2366
-
2367
2396
  (isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) {
2368
2397
  if (isObjectLike(srcValue)) {
2369
2398
  stackA || (stackA = []);
@@ -3647,7 +3676,8 @@
3647
3676
  } else {
3648
3677
  prereq = type == 'string' && index in object;
3649
3678
  }
3650
- return prereq && object[index] === value;
3679
+ var other = object[index];
3680
+ return prereq && (value === value ? value === other : other !== other);
3651
3681
  }
3652
3682
 
3653
3683
  /**
@@ -4042,7 +4072,7 @@
4042
4072
  * @returns {Array} Returns the new array of filtered values.
4043
4073
  * @example
4044
4074
  *
4045
- * _.difference([1, 2, 3], [5, 2, 10]);
4075
+ * _.difference([1, 2, 3], [4, 2]);
4046
4076
  * // => [1, 3]
4047
4077
  */
4048
4078
  function difference() {
@@ -4134,14 +4164,14 @@
4134
4164
  * Elements are dropped until `predicate` returns falsey. The predicate is
4135
4165
  * bound to `thisArg` and invoked with three arguments; (value, index, array).
4136
4166
  *
4137
- * If a property name is provided for `predicate` the created "_.property"
4167
+ * If a property name is provided for `predicate` the created `_.property`
4138
4168
  * style callback returns the property value of the given element.
4139
4169
  *
4140
- * If value is also provided for `thisArg` the created "_.matchesProperty"
4170
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
4141
4171
  * style callback returns `true` for elements that have a matching property
4142
4172
  * value, else `false`.
4143
4173
  *
4144
- * If an object is provided for `predicate` the created "_.matches" style
4174
+ * If an object is provided for `predicate` the created `_.matches` style
4145
4175
  * callback returns `true` for elements that match the properties of the given
4146
4176
  * object, else `false`.
4147
4177
  *
@@ -4150,29 +4180,31 @@
4150
4180
  * @category Array
4151
4181
  * @param {Array} array The array to query.
4152
4182
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
4153
- * per element.
4183
+ * per iteration.
4154
4184
  * @param {*} [thisArg] The `this` binding of `predicate`.
4155
4185
  * @returns {Array} Returns the slice of `array`.
4156
4186
  * @example
4157
4187
  *
4158
- * _.dropRightWhile([1, 2, 3], function(n) { return n > 1; });
4188
+ * _.dropRightWhile([1, 2, 3], function(n) {
4189
+ * return n > 1;
4190
+ * });
4159
4191
  * // => [1]
4160
4192
  *
4161
4193
  * var users = [
4162
- * { 'user': 'barney', 'age': 36, 'active': true },
4163
- * { 'user': 'fred', 'age': 40, 'active': false },
4164
- * { 'user': 'pebbles', 'age': 1, 'active': false }
4194
+ * { 'user': 'barney', 'active': true },
4195
+ * { 'user': 'fred', 'active': false },
4196
+ * { 'user': 'pebbles', 'active': false }
4165
4197
  * ];
4166
4198
  *
4167
- * // using the "_.matches" callback shorthand
4168
- * _.pluck(_.dropRightWhile(users, { 'age': 1, 'active': false }), 'user');
4199
+ * // using the `_.matches` callback shorthand
4200
+ * _.pluck(_.dropRightWhile(users, { 'user': pebbles, 'active': false }), 'user');
4169
4201
  * // => ['barney', 'fred']
4170
4202
  *
4171
- * // using the "_.matchesProperty" callback shorthand
4203
+ * // using the `_.matchesProperty` callback shorthand
4172
4204
  * _.pluck(_.dropRightWhile(users, 'active', false), 'user');
4173
4205
  * // => ['barney']
4174
4206
  *
4175
- * // using the "_.property" callback shorthand
4207
+ * // using the `_.property` callback shorthand
4176
4208
  * _.pluck(_.dropRightWhile(users, 'active'), 'user');
4177
4209
  * // => ['barney', 'fred', 'pebbles']
4178
4210
  */
@@ -4191,14 +4223,14 @@
4191
4223
  * Elements are dropped until `predicate` returns falsey. The predicate is
4192
4224
  * bound to `thisArg` and invoked with three arguments; (value, index, array).
4193
4225
  *
4194
- * If a property name is provided for `predicate` the created "_.property"
4226
+ * If a property name is provided for `predicate` the created `_.property`
4195
4227
  * style callback returns the property value of the given element.
4196
4228
  *
4197
- * If value is also provided for `thisArg` the created "_.matchesProperty"
4229
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
4198
4230
  * style callback returns `true` for elements that have a matching property
4199
4231
  * value, else `false`.
4200
4232
  *
4201
- * If an object is provided for `predicate` the created "_.matches" style
4233
+ * If an object is provided for `predicate` the created `_.matches` style
4202
4234
  * callback returns `true` for elements that have the properties of the given
4203
4235
  * object, else `false`.
4204
4236
  *
@@ -4207,29 +4239,31 @@
4207
4239
  * @category Array
4208
4240
  * @param {Array} array The array to query.
4209
4241
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
4210
- * per element.
4242
+ * per iteration.
4211
4243
  * @param {*} [thisArg] The `this` binding of `predicate`.
4212
4244
  * @returns {Array} Returns the slice of `array`.
4213
4245
  * @example
4214
4246
  *
4215
- * _.dropWhile([1, 2, 3], function(n) { return n < 3; });
4247
+ * _.dropWhile([1, 2, 3], function(n) {
4248
+ * return n < 3;
4249
+ * });
4216
4250
  * // => [3]
4217
4251
  *
4218
4252
  * var users = [
4219
- * { 'user': 'barney', 'age': 36, 'active': false },
4220
- * { 'user': 'fred', 'age': 40, 'active': false },
4221
- * { 'user': 'pebbles', 'age': 1, 'active': true }
4253
+ * { 'user': 'barney', 'active': false },
4254
+ * { 'user': 'fred', 'active': false },
4255
+ * { 'user': 'pebbles', 'active': true }
4222
4256
  * ];
4223
4257
  *
4224
- * // using the "_.matches" callback shorthand
4225
- * _.pluck(_.dropWhile(users, { 'age': 36, 'active': false }), 'user');
4258
+ * // using the `_.matches` callback shorthand
4259
+ * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
4226
4260
  * // => ['fred', 'pebbles']
4227
4261
  *
4228
- * // using the "_.matchesProperty" callback shorthand
4262
+ * // using the `_.matchesProperty` callback shorthand
4229
4263
  * _.pluck(_.dropWhile(users, 'active', false), 'user');
4230
4264
  * // => ['pebbles']
4231
4265
  *
4232
- * // using the "_.property" callback shorthand
4266
+ * // using the `_.property` callback shorthand
4233
4267
  * _.pluck(_.dropWhile(users, 'active'), 'user');
4234
4268
  * // => ['barney', 'fred', 'pebbles']
4235
4269
  */
@@ -4275,14 +4309,14 @@
4275
4309
  * This method is like `_.find` except that it returns the index of the first
4276
4310
  * element `predicate` returns truthy for, instead of the element itself.
4277
4311
  *
4278
- * If a property name is provided for `predicate` the created "_.property"
4312
+ * If a property name is provided for `predicate` the created `_.property`
4279
4313
  * style callback returns the property value of the given element.
4280
4314
  *
4281
- * If value is also provided for `thisArg` the created "_.matchesProperty"
4315
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
4282
4316
  * style callback returns `true` for elements that have a matching property
4283
4317
  * value, else `false`.
4284
4318
  *
4285
- * If an object is provided for `predicate` the created "_.matches" style
4319
+ * If an object is provided for `predicate` the created `_.matches` style
4286
4320
  * callback returns `true` for elements that have the properties of the given
4287
4321
  * object, else `false`.
4288
4322
  *
@@ -4291,32 +4325,33 @@
4291
4325
  * @category Array
4292
4326
  * @param {Array} array The array to search.
4293
4327
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
4294
- * per iteration. If a property name or object is provided it is used to
4295
- * create a "_.property" or "_.matches" style callback respectively.
4328
+ * per iteration.
4296
4329
  * @param {*} [thisArg] The `this` binding of `predicate`.
4297
4330
  * @returns {number} Returns the index of the found element, else `-1`.
4298
4331
  * @example
4299
4332
  *
4300
4333
  * var users = [
4301
- * { 'user': 'barney', 'age': 36, 'active': false },
4302
- * { 'user': 'fred', 'age': 40, 'active': true },
4303
- * { 'user': 'pebbles', 'age': 1, 'active': false }
4334
+ * { 'user': 'barney', 'active': false },
4335
+ * { 'user': 'fred', 'active': false },
4336
+ * { 'user': 'pebbles', 'active': true }
4304
4337
  * ];
4305
4338
  *
4306
- * _.findIndex(users, function(chr) { return chr.age < 40; });
4339
+ * _.findIndex(users, function(chr) {
4340
+ * return chr.user == 'barney';
4341
+ * });
4307
4342
  * // => 0
4308
4343
  *
4309
- * // using the "_.matches" callback shorthand
4310
- * _.findIndex(users, { 'age': 40, 'active': true });
4344
+ * // using the `_.matches` callback shorthand
4345
+ * _.findIndex(users, { 'user': 'fred', 'active': false });
4311
4346
  * // => 1
4312
4347
  *
4313
- * // using the "_.matchesProperty" callback shorthand
4314
- * _.findIndex(users, 'age', 1);
4315
- * // => 2
4348
+ * // using the `_.matchesProperty` callback shorthand
4349
+ * _.findIndex(users, 'active', false);
4350
+ * // => 0
4316
4351
  *
4317
- * // using the "_.property" callback shorthand
4352
+ * // using the `_.property` callback shorthand
4318
4353
  * _.findIndex(users, 'active');
4319
- * // => 1
4354
+ * // => 2
4320
4355
  */
4321
4356
  function findIndex(array, predicate, thisArg) {
4322
4357
  var index = -1,
@@ -4335,14 +4370,14 @@
4335
4370
  * This method is like `_.findIndex` except that it iterates over elements
4336
4371
  * of `collection` from right to left.
4337
4372
  *
4338
- * If a property name is provided for `predicate` the created "_.property"
4373
+ * If a property name is provided for `predicate` the created `_.property`
4339
4374
  * style callback returns the property value of the given element.
4340
4375
  *
4341
- * If value is also provided for `thisArg` the created "_.matchesProperty"
4376
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
4342
4377
  * style callback returns `true` for elements that have a matching property
4343
4378
  * value, else `false`.
4344
4379
  *
4345
- * If an object is provided for `predicate` the created "_.matches" style
4380
+ * If an object is provided for `predicate` the created `_.matches` style
4346
4381
  * callback returns `true` for elements that have the properties of the given
4347
4382
  * object, else `false`.
4348
4383
  *
@@ -4351,30 +4386,31 @@
4351
4386
  * @category Array
4352
4387
  * @param {Array} array The array to search.
4353
4388
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
4354
- * per iteration. If a property name or object is provided it is used to
4355
- * create a "_.property" or "_.matches" style callback respectively.
4389
+ * per iteration.
4356
4390
  * @param {*} [thisArg] The `this` binding of `predicate`.
4357
4391
  * @returns {number} Returns the index of the found element, else `-1`.
4358
4392
  * @example
4359
4393
  *
4360
4394
  * var users = [
4361
- * { 'user': 'barney', 'age': 36, 'active': true },
4362
- * { 'user': 'fred', 'age': 40, 'active': false },
4363
- * { 'user': 'pebbles', 'age': 1, 'active': false }
4395
+ * { 'user': 'barney', 'active': true },
4396
+ * { 'user': 'fred', 'active': false },
4397
+ * { 'user': 'pebbles', 'active': false }
4364
4398
  * ];
4365
4399
  *
4366
- * _.findLastIndex(users, function(chr) { return chr.age < 40; });
4400
+ * _.findLastIndex(users, function(chr) {
4401
+ * return chr.user == 'pebbles';
4402
+ * });
4367
4403
  * // => 2
4368
4404
  *
4369
- * // using the "_.matches" callback shorthand
4370
- * _.findLastIndex(users, { 'age': 36, 'active': true });
4405
+ * // using the `_.matches` callback shorthand
4406
+ * _.findLastIndex(users, { user': 'barney', 'active': true });
4371
4407
  * // => 0
4372
4408
  *
4373
- * // using the "_.matchesProperty" callback shorthand
4374
- * _.findLastIndex(users, 'age', 40);
4409
+ * // using the `_.matchesProperty` callback shorthand
4410
+ * _.findLastIndex(users, 'active', false);
4375
4411
  * // => 1
4376
4412
  *
4377
- * // using the "_.property" callback shorthand
4413
+ * // using the `_.property` callback shorthand
4378
4414
  * _.findLastIndex(users, 'active');
4379
4415
  * // => 0
4380
4416
  */
@@ -4423,11 +4459,11 @@
4423
4459
  * @returns {Array} Returns the new flattened array.
4424
4460
  * @example
4425
4461
  *
4426
- * _.flatten([1, [2], [3, [[4]]]]);
4427
- * // => [1, 2, 3, [[4]]];
4462
+ * _.flatten([1, [2, 3, [4]]]);
4463
+ * // => [1, 2, 3, [4]];
4428
4464
  *
4429
4465
  * // using `isDeep`
4430
- * _.flatten([1, [2], [3, [[4]]]], true);
4466
+ * _.flatten([1, [2, 3, [4]]], true);
4431
4467
  * // => [1, 2, 3, 4];
4432
4468
  */
4433
4469
  function flatten(array, isDeep, guard) {
@@ -4448,7 +4484,7 @@
4448
4484
  * @returns {Array} Returns the new flattened array.
4449
4485
  * @example
4450
4486
  *
4451
- * _.flattenDeep([1, [2], [3, [[4]]]]);
4487
+ * _.flattenDeep([1, [2, 3, [4]]]);
4452
4488
  * // => [1, 2, 3, 4];
4453
4489
  */
4454
4490
  function flattenDeep(array) {
@@ -4477,15 +4513,15 @@
4477
4513
  * @returns {number} Returns the index of the matched value, else `-1`.
4478
4514
  * @example
4479
4515
  *
4480
- * _.indexOf([1, 2, 3, 1, 2, 3], 2);
4481
- * // => 1
4516
+ * _.indexOf([1, 2, 1, 2], 2);
4517
+ * // => 2
4482
4518
  *
4483
4519
  * // using `fromIndex`
4484
- * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
4485
- * // => 4
4520
+ * _.indexOf([1, 2, 1, 2], 2, 2);
4521
+ * // => 3
4486
4522
  *
4487
4523
  * // performing a binary search
4488
- * _.indexOf([4, 4, 5, 5, 6, 6], 5, true);
4524
+ * _.indexOf([1, 1, 2, 2], 2, true);
4489
4525
  * // => 2
4490
4526
  */
4491
4527
  function indexOf(array, value, fromIndex) {
@@ -4536,9 +4572,8 @@
4536
4572
  * @param {...Array} [arrays] The arrays to inspect.
4537
4573
  * @returns {Array} Returns the new array of shared values.
4538
4574
  * @example
4539
- *
4540
- * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
4541
- * // => [1, 2]
4575
+ * _.intersection([1, 2], [4, 2], [2, 1]);
4576
+ * // => [2]
4542
4577
  */
4543
4578
  function intersection() {
4544
4579
  var args = [],
@@ -4614,15 +4649,15 @@
4614
4649
  * @returns {number} Returns the index of the matched value, else `-1`.
4615
4650
  * @example
4616
4651
  *
4617
- * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
4618
- * // => 4
4652
+ * _.lastIndexOf([1, 2, 1, 2], 2);
4653
+ * // => 3
4619
4654
  *
4620
4655
  * // using `fromIndex`
4621
- * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
4656
+ * _.lastIndexOf([1, 2, 1, 2], 2, 2);
4622
4657
  * // => 1
4623
4658
  *
4624
4659
  * // performing a binary search
4625
- * _.lastIndexOf([4, 4, 5, 5, 6, 6], 5, true);
4660
+ * _.lastIndexOf([1, 1, 2, 2], 2, true);
4626
4661
  * // => 3
4627
4662
  */
4628
4663
  function lastIndexOf(array, value, fromIndex) {
@@ -4668,6 +4703,7 @@
4668
4703
  * @example
4669
4704
  *
4670
4705
  * var array = [1, 2, 3, 1, 2, 3];
4706
+ *
4671
4707
  * _.pull(array, 2, 3);
4672
4708
  * console.log(array);
4673
4709
  * // => [1, 1]
@@ -4709,7 +4745,7 @@
4709
4745
  * @example
4710
4746
  *
4711
4747
  * var array = [5, 10, 15, 20];
4712
- * var evens = _.pullAt(array, [1, 3]);
4748
+ * var evens = _.pullAt(array, 1, 3);
4713
4749
  *
4714
4750
  * console.log(array);
4715
4751
  * // => [5, 15]
@@ -4726,14 +4762,14 @@
4726
4762
  * and returns an array of the removed elements. The predicate is bound to
4727
4763
  * `thisArg` and invoked with three arguments; (value, index, array).
4728
4764
  *
4729
- * If a property name is provided for `predicate` the created "_.property"
4765
+ * If a property name is provided for `predicate` the created `_.property`
4730
4766
  * style callback returns the property value of the given element.
4731
4767
  *
4732
- * If value is also provided for `thisArg` the created "_.matchesProperty"
4768
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
4733
4769
  * style callback returns `true` for elements that have a matching property
4734
4770
  * value, else `false`.
4735
4771
  *
4736
- * If an object is provided for `predicate` the created "_.matches" style
4772
+ * If an object is provided for `predicate` the created `_.matches` style
4737
4773
  * callback returns `true` for elements that have the properties of the given
4738
4774
  * object, else `false`.
4739
4775
  *
@@ -4744,14 +4780,15 @@
4744
4780
  * @category Array
4745
4781
  * @param {Array} array The array to modify.
4746
4782
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
4747
- * per iteration. If a property name or object is provided it is used to
4748
- * create a "_.property" or "_.matches" style callback respectively.
4783
+ * per iteration.
4749
4784
  * @param {*} [thisArg] The `this` binding of `predicate`.
4750
4785
  * @returns {Array} Returns the new array of removed elements.
4751
4786
  * @example
4752
4787
  *
4753
4788
  * var array = [1, 2, 3, 4];
4754
- * var evens = _.remove(array, function(n) { return n % 2 == 0; });
4789
+ * var evens = _.remove(array, function(n) {
4790
+ * return n % 2 == 0;
4791
+ * });
4755
4792
  *
4756
4793
  * console.log(array);
4757
4794
  * // => [1, 3]
@@ -4827,14 +4864,14 @@
4827
4864
  * to compute their sort ranking. The iteratee is bound to `thisArg` and
4828
4865
  * invoked with one argument; (value).
4829
4866
  *
4830
- * If a property name is provided for `predicate` the created "_.property"
4867
+ * If a property name is provided for `predicate` the created `_.property`
4831
4868
  * style callback returns the property value of the given element.
4832
4869
  *
4833
- * If value is also provided for `thisArg` the created "_.matchesProperty"
4870
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
4834
4871
  * style callback returns `true` for elements that have a matching property
4835
4872
  * value, else `false`.
4836
4873
  *
4837
- * If an object is provided for `predicate` the created "_.matches" style
4874
+ * If an object is provided for `predicate` the created `_.matches` style
4838
4875
  * callback returns `true` for elements that have the properties of the given
4839
4876
  * object, else `false`.
4840
4877
  *
@@ -4844,8 +4881,7 @@
4844
4881
  * @param {Array} array The sorted array to inspect.
4845
4882
  * @param {*} value The value to evaluate.
4846
4883
  * @param {Function|Object|string} [iteratee=_.identity] The function invoked
4847
- * per iteration. If a property name or object is provided it is used to
4848
- * create a "_.property" or "_.matches" style callback respectively.
4884
+ * per iteration.
4849
4885
  * @param {*} [thisArg] The `this` binding of `iteratee`.
4850
4886
  * @returns {number} Returns the index at which `value` should be inserted
4851
4887
  * into `array`.
@@ -4854,7 +4890,7 @@
4854
4890
  * _.sortedIndex([30, 50], 40);
4855
4891
  * // => 1
4856
4892
  *
4857
- * _.sortedIndex([4, 4, 5, 5, 6, 6], 5);
4893
+ * _.sortedIndex([4, 4, 5, 5], 5);
4858
4894
  * // => 2
4859
4895
  *
4860
4896
  * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
@@ -4865,7 +4901,7 @@
4865
4901
  * }, dict);
4866
4902
  * // => 1
4867
4903
  *
4868
- * // using the "_.property" callback shorthand
4904
+ * // using the `_.property` callback shorthand
4869
4905
  * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
4870
4906
  * // => 1
4871
4907
  */
@@ -4887,14 +4923,13 @@
4887
4923
  * @param {Array} array The sorted array to inspect.
4888
4924
  * @param {*} value The value to evaluate.
4889
4925
  * @param {Function|Object|string} [iteratee=_.identity] The function invoked
4890
- * per iteration. If a property name or object is provided it is used to
4891
- * create a "_.property" or "_.matches" style callback respectively.
4926
+ * per iteration.
4892
4927
  * @param {*} [thisArg] The `this` binding of `iteratee`.
4893
4928
  * @returns {number} Returns the index at which `value` should be inserted
4894
4929
  * into `array`.
4895
4930
  * @example
4896
4931
  *
4897
- * _.sortedLastIndex([4, 4, 5, 5, 6, 6], 5);
4932
+ * _.sortedLastIndex([4, 4, 5, 5], 5);
4898
4933
  * // => 4
4899
4934
  */
4900
4935
  function sortedLastIndex(array, value, iteratee, thisArg) {
@@ -4980,14 +5015,14 @@
4980
5015
  * taken until `predicate` returns falsey. The predicate is bound to `thisArg`
4981
5016
  * and invoked with three arguments; (value, index, array).
4982
5017
  *
4983
- * If a property name is provided for `predicate` the created "_.property"
5018
+ * If a property name is provided for `predicate` the created `_.property`
4984
5019
  * style callback returns the property value of the given element.
4985
5020
  *
4986
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5021
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
4987
5022
  * style callback returns `true` for elements that have a matching property
4988
5023
  * value, else `false`.
4989
5024
  *
4990
- * If an object is provided for `predicate` the created "_.matches" style
5025
+ * If an object is provided for `predicate` the created `_.matches` style
4991
5026
  * callback returns `true` for elements that have the properties of the given
4992
5027
  * object, else `false`.
4993
5028
  *
@@ -4996,29 +5031,31 @@
4996
5031
  * @category Array
4997
5032
  * @param {Array} array The array to query.
4998
5033
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
4999
- * per element.
5034
+ * per iteration.
5000
5035
  * @param {*} [thisArg] The `this` binding of `predicate`.
5001
5036
  * @returns {Array} Returns the slice of `array`.
5002
5037
  * @example
5003
5038
  *
5004
- * _.takeRightWhile([1, 2, 3], function(n) { return n > 1; });
5039
+ * _.takeRightWhile([1, 2, 3], function(n) {
5040
+ * return n > 1;
5041
+ * });
5005
5042
  * // => [2, 3]
5006
5043
  *
5007
5044
  * var users = [
5008
- * { 'user': 'barney', 'age': 36, 'active': true },
5009
- * { 'user': 'fred', 'age': 40, 'active': false },
5010
- * { 'user': 'pebbles', 'age': 1, 'active': false }
5045
+ * { 'user': 'barney', 'active': true },
5046
+ * { 'user': 'fred', 'active': false },
5047
+ * { 'user': 'pebbles', 'active': false }
5011
5048
  * ];
5012
5049
  *
5013
- * // using the "_.matches" callback shorthand
5014
- * _.pluck(_.takeRightWhile(users, { 'age': 1, 'active': true }), 'user');
5050
+ * // using the `_.matches` callback shorthand
5051
+ * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
5015
5052
  * // => ['pebbles']
5016
5053
  *
5017
- * // using the "_.matchesProperty" callback shorthand
5054
+ * // using the `_.matchesProperty` callback shorthand
5018
5055
  * _.pluck(_.takeRightWhile(users, 'active', false), 'user');
5019
5056
  * // => ['fred', 'pebbles']
5020
5057
  *
5021
- * // using the "_.property" callback shorthand
5058
+ * // using the `_.property` callback shorthand
5022
5059
  * _.pluck(_.takeRightWhile(users, 'active'), 'user');
5023
5060
  * // => []
5024
5061
  */
@@ -5037,14 +5074,14 @@
5037
5074
  * are taken until `predicate` returns falsey. The predicate is bound to
5038
5075
  * `thisArg` and invoked with three arguments; (value, index, array).
5039
5076
  *
5040
- * If a property name is provided for `predicate` the created "_.property"
5077
+ * If a property name is provided for `predicate` the created `_.property`
5041
5078
  * style callback returns the property value of the given element.
5042
5079
  *
5043
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5080
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
5044
5081
  * style callback returns `true` for elements that have a matching property
5045
5082
  * value, else `false`.
5046
5083
  *
5047
- * If an object is provided for `predicate` the created "_.matches" style
5084
+ * If an object is provided for `predicate` the created `_.matches` style
5048
5085
  * callback returns `true` for elements that have the properties of the given
5049
5086
  * object, else `false`.
5050
5087
  *
@@ -5053,29 +5090,31 @@
5053
5090
  * @category Array
5054
5091
  * @param {Array} array The array to query.
5055
5092
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
5056
- * per element.
5093
+ * per iteration.
5057
5094
  * @param {*} [thisArg] The `this` binding of `predicate`.
5058
5095
  * @returns {Array} Returns the slice of `array`.
5059
5096
  * @example
5060
5097
  *
5061
- * _.takeWhile([1, 2, 3], function(n) { return n < 3; });
5098
+ * _.takeWhile([1, 2, 3], function(n) {
5099
+ * return n < 3;
5100
+ * });
5062
5101
  * // => [1, 2]
5063
5102
  *
5064
5103
  * var users = [
5065
- * { 'user': 'barney', 'age': 36, 'active': false },
5066
- * { 'user': 'fred', 'age': 40, 'active': false },
5067
- * { 'user': 'pebbles', 'age': 1, 'active': true }
5104
+ * { 'user': 'barney', 'active': false },
5105
+ * { 'user': 'fred', 'active': false},
5106
+ * { 'user': 'pebbles', 'active': true }
5068
5107
  * ];
5069
5108
  *
5070
- * // using the "_.matches" callback shorthand
5071
- * _.pluck(_.takeWhile(users, { 'age': 36, 'active': true }), 'user');
5109
+ * // using the `_.matches` callback shorthand
5110
+ * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
5072
5111
  * // => ['barney']
5073
5112
  *
5074
- * // using the "_.matchesProperty" callback shorthand
5113
+ * // using the `_.matchesProperty` callback shorthand
5075
5114
  * _.pluck(_.takeWhile(users, 'active', false), 'user');
5076
5115
  * // => ['barney', 'fred']
5077
5116
  *
5078
- * // using the "_.property" callback shorthand
5117
+ * // using the `_.property` callback shorthand
5079
5118
  * _.pluck(_.takeWhile(users, 'active'), 'user');
5080
5119
  * // => []
5081
5120
  */
@@ -5106,8 +5145,8 @@
5106
5145
  * @returns {Array} Returns the new array of combined values.
5107
5146
  * @example
5108
5147
  *
5109
- * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
5110
- * // => [1, 2, 3, 5, 4]
5148
+ * _.union([1, 2], [4, 2], [2, 1]);
5149
+ * // => [1, 2, 4]
5111
5150
  */
5112
5151
  function union() {
5113
5152
  return baseUniq(baseFlatten(arguments, false, true));
@@ -5121,14 +5160,14 @@
5121
5160
  * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked
5122
5161
  * with three arguments; (value, index, array).
5123
5162
  *
5124
- * If a property name is provided for `predicate` the created "_.property"
5163
+ * If a property name is provided for `predicate` the created `_.property`
5125
5164
  * style callback returns the property value of the given element.
5126
5165
  *
5127
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5166
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
5128
5167
  * style callback returns `true` for elements that have a matching property
5129
5168
  * value, else `false`.
5130
5169
  *
5131
- * If an object is provided for `predicate` the created "_.matches" style
5170
+ * If an object is provided for `predicate` the created `_.matches` style
5132
5171
  * callback returns `true` for elements that have the properties of the given
5133
5172
  * object, else `false`.
5134
5173
  *
@@ -5144,8 +5183,6 @@
5144
5183
  * @param {Array} array The array to inspect.
5145
5184
  * @param {boolean} [isSorted] Specify the array is sorted.
5146
5185
  * @param {Function|Object|string} [iteratee] The function invoked per iteration.
5147
- * If a property name or object is provided it is used to create a "_.property"
5148
- * or "_.matches" style callback respectively.
5149
5186
  * @param {*} [thisArg] The `this` binding of `iteratee`.
5150
5187
  * @returns {Array} Returns the new duplicate-value-free array.
5151
5188
  * @example
@@ -5158,10 +5195,12 @@
5158
5195
  * // => [1, 2]
5159
5196
  *
5160
5197
  * // using an iteratee function
5161
- * _.uniq([1, 2.5, 1.5, 2], function(n) { return this.floor(n); }, Math);
5198
+ * _.uniq([1, 2.5, 1.5, 2], function(n) {
5199
+ * return this.floor(n);
5200
+ * }, Math);
5162
5201
  * // => [1, 2.5]
5163
5202
  *
5164
- * // using the "_.property" callback shorthand
5203
+ * // using the `_.property` callback shorthand
5165
5204
  * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
5166
5205
  * // => [{ 'x': 1 }, { 'x': 2 }]
5167
5206
  */
@@ -5170,8 +5209,7 @@
5170
5209
  if (!length) {
5171
5210
  return [];
5172
5211
  }
5173
- // Juggle arguments.
5174
- if (typeof isSorted != 'boolean' && isSorted != null) {
5212
+ if (isSorted != null && typeof isSorted != 'boolean') {
5175
5213
  thisArg = iteratee;
5176
5214
  iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted;
5177
5215
  isSorted = false;
@@ -5231,8 +5269,8 @@
5231
5269
  * @returns {Array} Returns the new array of filtered values.
5232
5270
  * @example
5233
5271
  *
5234
- * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
5235
- * // => [2, 3, 4]
5272
+ * _.without([1, 2, 1, 3], 1, 2);
5273
+ * // => [3]
5236
5274
  */
5237
5275
  function without(array) {
5238
5276
  return baseDifference(array, baseSlice(arguments, 1));
@@ -5250,11 +5288,8 @@
5250
5288
  * @returns {Array} Returns the new array of values.
5251
5289
  * @example
5252
5290
  *
5253
- * _.xor([1, 2, 3], [5, 2, 1, 4]);
5254
- * // => [3, 5, 4]
5255
- *
5256
- * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]);
5257
- * // => [1, 4, 5]
5291
+ * _.xor([1, 2], [4, 2]);
5292
+ * // => [1, 4]
5258
5293
  */
5259
5294
  function xor() {
5260
5295
  var index = -1,
@@ -5353,7 +5388,9 @@
5353
5388
  *
5354
5389
  * var youngest = _.chain(users)
5355
5390
  * .sortBy('age')
5356
- * .map(function(chr) { return chr.user + ' is ' + chr.age; })
5391
+ * .map(function(chr) {
5392
+ * return chr.user + ' is ' + chr.age;
5393
+ * })
5357
5394
  * .first()
5358
5395
  * .value();
5359
5396
  * // => 'pebbles is 1'
@@ -5380,7 +5417,9 @@
5380
5417
  * @example
5381
5418
  *
5382
5419
  * _([1, 2, 3])
5383
- * .tap(function(array) { array.pop(); })
5420
+ * .tap(function(array) {
5421
+ * array.pop();
5422
+ * })
5384
5423
  * .reverse()
5385
5424
  * .value();
5386
5425
  * // => [2, 1]
@@ -5404,7 +5443,9 @@
5404
5443
  *
5405
5444
  * _([1, 2, 3])
5406
5445
  * .last()
5407
- * .thru(function(value) { return [value]; })
5446
+ * .thru(function(value) {
5447
+ * return [value];
5448
+ * })
5408
5449
  * .value();
5409
5450
  * // => [3]
5410
5451
  */
@@ -5497,7 +5538,7 @@
5497
5538
  var result,
5498
5539
  parent = this;
5499
5540
 
5500
- while (parent instanceof LodashWrapper) {
5541
+ while (parent instanceof baseLodash) {
5501
5542
  var clone = wrapperClone(parent);
5502
5543
  if (result) {
5503
5544
  previous.__wrapped__ = clone;
@@ -5593,8 +5634,8 @@
5593
5634
  * @returns {Array} Returns the new array of picked elements.
5594
5635
  * @example
5595
5636
  *
5596
- * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
5597
- * // => ['a', 'c', 'e']
5637
+ * _.at(['a', 'b', 'c'], [0, 2]);
5638
+ * // => ['a', 'c']
5598
5639
  *
5599
5640
  * _.at(['fred', 'barney', 'pebbles'], 0, 2);
5600
5641
  * // => ['fred', 'pebbles']
@@ -5607,57 +5648,6 @@
5607
5648
  return baseAt(collection, baseFlatten(arguments, false, false, 1));
5608
5649
  }
5609
5650
 
5610
- /**
5611
- * Checks if `value` is in `collection` using `SameValueZero` for equality
5612
- * comparisons. If `fromIndex` is negative, it is used as the offset from
5613
- * the end of `collection`.
5614
- *
5615
- * **Note:** `SameValueZero` comparisons are like strict equality comparisons,
5616
- * e.g. `===`, except that `NaN` matches `NaN`. See the
5617
- * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
5618
- * for more details.
5619
- *
5620
- * @static
5621
- * @memberOf _
5622
- * @alias contains, include
5623
- * @category Collection
5624
- * @param {Array|Object|string} collection The collection to search.
5625
- * @param {*} target The value to search for.
5626
- * @param {number} [fromIndex=0] The index to search from.
5627
- * @returns {boolean} Returns `true` if a matching element is found, else `false`.
5628
- * @example
5629
- *
5630
- * _.includes([1, 2, 3], 1);
5631
- * // => true
5632
- *
5633
- * _.includes([1, 2, 3], 1, 2);
5634
- * // => false
5635
- *
5636
- * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
5637
- * // => true
5638
- *
5639
- * _.includes('pebbles', 'eb');
5640
- * // => true
5641
- */
5642
- function includes(collection, target, fromIndex) {
5643
- var length = collection ? collection.length : 0;
5644
- if (!isLength(length)) {
5645
- collection = values(collection);
5646
- length = collection.length;
5647
- }
5648
- if (!length) {
5649
- return false;
5650
- }
5651
- if (typeof fromIndex == 'number') {
5652
- fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
5653
- } else {
5654
- fromIndex = 0;
5655
- }
5656
- return (typeof collection == 'string' || !isArray(collection) && isString(collection))
5657
- ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1)
5658
- : (getIndexOf(collection, target, fromIndex) > -1);
5659
- }
5660
-
5661
5651
  /**
5662
5652
  * Creates an object composed of keys generated from the results of running
5663
5653
  * each element of `collection` through `iteratee`. The corresponding value
@@ -5665,14 +5655,14 @@
5665
5655
  * The `iteratee` is bound to `thisArg` and invoked with three arguments;
5666
5656
  * (value, index|key, collection).
5667
5657
  *
5668
- * If a property name is provided for `predicate` the created "_.property"
5658
+ * If a property name is provided for `predicate` the created `_.property`
5669
5659
  * style callback returns the property value of the given element.
5670
5660
  *
5671
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5661
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
5672
5662
  * style callback returns `true` for elements that have a matching property
5673
5663
  * value, else `false`.
5674
5664
  *
5675
- * If an object is provided for `predicate` the created "_.matches" style
5665
+ * If an object is provided for `predicate` the created `_.matches` style
5676
5666
  * callback returns `true` for elements that have the properties of the given
5677
5667
  * object, else `false`.
5678
5668
  *
@@ -5681,16 +5671,19 @@
5681
5671
  * @category Collection
5682
5672
  * @param {Array|Object|string} collection The collection to iterate over.
5683
5673
  * @param {Function|Object|string} [iteratee=_.identity] The function invoked
5684
- * per iteration. If a property name or object is provided it is used to
5685
- * create a "_.property" or "_.matches" style callback respectively.
5674
+ * per iteration.
5686
5675
  * @param {*} [thisArg] The `this` binding of `iteratee`.
5687
5676
  * @returns {Object} Returns the composed aggregate object.
5688
5677
  * @example
5689
5678
  *
5690
- * _.countBy([4.3, 6.1, 6.4], function(n) { return Math.floor(n); });
5679
+ * _.countBy([4.3, 6.1, 6.4], function(n) {
5680
+ * return Math.floor(n);
5681
+ * });
5691
5682
  * // => { '4': 1, '6': 2 }
5692
5683
  *
5693
- * _.countBy([4.3, 6.1, 6.4], function(n) { return this.floor(n); }, Math);
5684
+ * _.countBy([4.3, 6.1, 6.4], function(n) {
5685
+ * return this.floor(n);
5686
+ * }, Math);
5694
5687
  * // => { '4': 1, '6': 2 }
5695
5688
  *
5696
5689
  * _.countBy(['one', 'two', 'three'], 'length');
@@ -5705,14 +5698,14 @@
5705
5698
  * The predicate is bound to `thisArg` and invoked with three arguments;
5706
5699
  * (value, index|key, collection).
5707
5700
  *
5708
- * If a property name is provided for `predicate` the created "_.property"
5701
+ * If a property name is provided for `predicate` the created `_.property`
5709
5702
  * style callback returns the property value of the given element.
5710
5703
  *
5711
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5704
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
5712
5705
  * style callback returns `true` for elements that have a matching property
5713
5706
  * value, else `false`.
5714
5707
  *
5715
- * If an object is provided for `predicate` the created "_.matches" style
5708
+ * If an object is provided for `predicate` the created `_.matches` style
5716
5709
  * callback returns `true` for elements that have the properties of the given
5717
5710
  * object, else `false`.
5718
5711
  *
@@ -5722,30 +5715,29 @@
5722
5715
  * @category Collection
5723
5716
  * @param {Array|Object|string} collection The collection to iterate over.
5724
5717
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
5725
- * per iteration. If a property name or object is provided it is used to
5726
- * create a "_.property" or "_.matches" style callback respectively.
5718
+ * per iteration.
5727
5719
  * @param {*} [thisArg] The `this` binding of `predicate`.
5728
5720
  * @returns {boolean} Returns `true` if all elements pass the predicate check,
5729
5721
  * else `false`.
5730
5722
  * @example
5731
5723
  *
5732
- * _.every([true, 1, null, 'yes']);
5724
+ * _.every([true, 1, null, 'yes'], Boolean);
5733
5725
  * // => false
5734
5726
  *
5735
5727
  * var users = [
5736
- * { 'user': 'barney', 'age': 36, 'active': false },
5737
- * { 'user': 'fred', 'age': 40, 'active': false }
5728
+ * { 'user': 'barney', 'active': false },
5729
+ * { 'user': 'fred', 'active': false }
5738
5730
  * ];
5739
5731
  *
5740
- * // using the "_.matches" callback shorthand
5741
- * _.every(users, { 'age': 36, 'active': false });
5732
+ * // using the `_.matches` callback shorthand
5733
+ * _.every(users, { 'user': 'barney', 'active': false });
5742
5734
  * // => false
5743
5735
  *
5744
- * // using the "_.matchesProperty" callback shorthand
5736
+ * // using the `_.matchesProperty` callback shorthand
5745
5737
  * _.every(users, 'active', false);
5746
5738
  * // => true
5747
5739
  *
5748
- * // using the "_.property" callback shorthand
5740
+ * // using the `_.property` callback shorthand
5749
5741
  * _.every(users, 'active');
5750
5742
  * // => false
5751
5743
  */
@@ -5762,14 +5754,14 @@
5762
5754
  * `predicate` returns truthy for. The predicate is bound to `thisArg` and
5763
5755
  * invoked with three arguments; (value, index|key, collection).
5764
5756
  *
5765
- * If a property name is provided for `predicate` the created "_.property"
5757
+ * If a property name is provided for `predicate` the created `_.property`
5766
5758
  * style callback returns the property value of the given element.
5767
5759
  *
5768
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5760
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
5769
5761
  * style callback returns `true` for elements that have a matching property
5770
5762
  * value, else `false`.
5771
5763
  *
5772
- * If an object is provided for `predicate` the created "_.matches" style
5764
+ * If an object is provided for `predicate` the created `_.matches` style
5773
5765
  * callback returns `true` for elements that have the properties of the given
5774
5766
  * object, else `false`.
5775
5767
  *
@@ -5779,29 +5771,30 @@
5779
5771
  * @category Collection
5780
5772
  * @param {Array|Object|string} collection The collection to iterate over.
5781
5773
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
5782
- * per iteration. If a property name or object is provided it is used to
5783
- * create a "_.property" or "_.matches" style callback respectively.
5774
+ * per iteration.
5784
5775
  * @param {*} [thisArg] The `this` binding of `predicate`.
5785
5776
  * @returns {Array} Returns the new filtered array.
5786
5777
  * @example
5787
5778
  *
5788
- * var evens = _.filter([1, 2, 3, 4], function(n) { return n % 2 == 0; });
5789
- * // => [2, 4]
5779
+ * _.filter([4, 5, 6], function(n) {
5780
+ * return n % 2 == 0;
5781
+ * });
5782
+ * // => [4, 6]
5790
5783
  *
5791
5784
  * var users = [
5792
5785
  * { 'user': 'barney', 'age': 36, 'active': true },
5793
5786
  * { 'user': 'fred', 'age': 40, 'active': false }
5794
5787
  * ];
5795
5788
  *
5796
- * // using the "_.matches" callback shorthand
5789
+ * // using the `_.matches` callback shorthand
5797
5790
  * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
5798
5791
  * // => ['barney']
5799
5792
  *
5800
- * // using the "_.matchesProperty" callback shorthand
5793
+ * // using the `_.matchesProperty` callback shorthand
5801
5794
  * _.pluck(_.filter(users, 'active', false), 'user');
5802
5795
  * // => ['fred']
5803
5796
  *
5804
- * // using the "_.property" callback shorthand
5797
+ * // using the `_.property` callback shorthand
5805
5798
  * _.pluck(_.filter(users, 'active'), 'user');
5806
5799
  * // => ['barney']
5807
5800
  */
@@ -5816,14 +5809,14 @@
5816
5809
  * `predicate` returns truthy for. The predicate is bound to `thisArg` and
5817
5810
  * invoked with three arguments; (value, index|key, collection).
5818
5811
  *
5819
- * If a property name is provided for `predicate` the created "_.property"
5812
+ * If a property name is provided for `predicate` the created `_.property`
5820
5813
  * style callback returns the property value of the given element.
5821
5814
  *
5822
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5815
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
5823
5816
  * style callback returns `true` for elements that have a matching property
5824
5817
  * value, else `false`.
5825
5818
  *
5826
- * If an object is provided for `predicate` the created "_.matches" style
5819
+ * If an object is provided for `predicate` the created `_.matches` style
5827
5820
  * callback returns `true` for elements that have the properties of the given
5828
5821
  * object, else `false`.
5829
5822
  *
@@ -5833,8 +5826,7 @@
5833
5826
  * @category Collection
5834
5827
  * @param {Array|Object|string} collection The collection to search.
5835
5828
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
5836
- * per iteration. If a property name or object is provided it is used to
5837
- * create a "_.property" or "_.matches" style callback respectively.
5829
+ * per iteration.
5838
5830
  * @param {*} [thisArg] The `this` binding of `predicate`.
5839
5831
  * @returns {*} Returns the matched element, else `undefined`.
5840
5832
  * @example
@@ -5845,18 +5837,20 @@
5845
5837
  * { 'user': 'pebbles', 'age': 1, 'active': true }
5846
5838
  * ];
5847
5839
  *
5848
- * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user');
5840
+ * _.result(_.find(users, function(chr) {
5841
+ * return chr.age < 40;
5842
+ * }), 'user');
5849
5843
  * // => 'barney'
5850
5844
  *
5851
- * // using the "_.matches" callback shorthand
5845
+ * // using the `_.matches` callback shorthand
5852
5846
  * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
5853
5847
  * // => 'pebbles'
5854
5848
  *
5855
- * // using the "_.matchesProperty" callback shorthand
5849
+ * // using the `_.matchesProperty` callback shorthand
5856
5850
  * _.result(_.find(users, 'active', false), 'user');
5857
5851
  * // => 'fred'
5858
5852
  *
5859
- * // using the "_.property" callback shorthand
5853
+ * // using the `_.property` callback shorthand
5860
5854
  * _.result(_.find(users, 'active'), 'user');
5861
5855
  * // => 'barney'
5862
5856
  */
@@ -5878,13 +5872,14 @@
5878
5872
  * @category Collection
5879
5873
  * @param {Array|Object|string} collection The collection to search.
5880
5874
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
5881
- * per iteration. If a property name or object is provided it is used to
5882
- * create a "_.property" or "_.matches" style callback respectively.
5875
+ * per iteration.
5883
5876
  * @param {*} [thisArg] The `this` binding of `predicate`.
5884
5877
  * @returns {*} Returns the matched element, else `undefined`.
5885
5878
  * @example
5886
5879
  *
5887
- * _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; });
5880
+ * _.findLast([1, 2, 3, 4], function(n) {
5881
+ * return n % 2 == 1;
5882
+ * });
5888
5883
  * // => 3
5889
5884
  */
5890
5885
  function findLast(collection, predicate, thisArg) {
@@ -5945,10 +5940,14 @@
5945
5940
  * @returns {Array|Object|string} Returns `collection`.
5946
5941
  * @example
5947
5942
  *
5948
- * _([1, 2, 3]).forEach(function(n) { console.log(n); }).value();
5943
+ * _([1, 2]).forEach(function(n) {
5944
+ * console.log(n);
5945
+ * }).value();
5949
5946
  * // => logs each value from left to right and returns the array
5950
5947
  *
5951
- * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); });
5948
+ * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
5949
+ * console.log(n, key);
5950
+ * });
5952
5951
  * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
5953
5952
  */
5954
5953
  function forEach(collection, iteratee, thisArg) {
@@ -5971,7 +5970,9 @@
5971
5970
  * @returns {Array|Object|string} Returns `collection`.
5972
5971
  * @example
5973
5972
  *
5974
- * _([1, 2, 3]).forEachRight(function(n) { console.log(n); }).join(',');
5973
+ * _([1, 2]).forEachRight(function(n) {
5974
+ * console.log(n);
5975
+ * }).join(',');
5975
5976
  * // => logs each value from right to left and returns the array
5976
5977
  */
5977
5978
  function forEachRight(collection, iteratee, thisArg) {
@@ -5987,14 +5988,14 @@
5987
5988
  * The `iteratee` is bound to `thisArg` and invoked with three arguments;
5988
5989
  * (value, index|key, collection).
5989
5990
  *
5990
- * If a property name is provided for `predicate` the created "_.property"
5991
+ * If a property name is provided for `predicate` the created `_.property`
5991
5992
  * style callback returns the property value of the given element.
5992
5993
  *
5993
- * If value is also provided for `thisArg` the created "_.matchesProperty"
5994
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
5994
5995
  * style callback returns `true` for elements that have a matching property
5995
5996
  * value, else `false`.
5996
5997
  *
5997
- * If an object is provided for `predicate` the created "_.matches" style
5998
+ * If an object is provided for `predicate` the created `_.matches` style
5998
5999
  * callback returns `true` for elements that have the properties of the given
5999
6000
  * object, else `false`.
6000
6001
  *
@@ -6003,19 +6004,22 @@
6003
6004
  * @category Collection
6004
6005
  * @param {Array|Object|string} collection The collection to iterate over.
6005
6006
  * @param {Function|Object|string} [iteratee=_.identity] The function invoked
6006
- * per iteration. If a property name or object is provided it is used to
6007
- * create a "_.property" or "_.matches" style callback respectively.
6007
+ * per iteration.
6008
6008
  * @param {*} [thisArg] The `this` binding of `iteratee`.
6009
6009
  * @returns {Object} Returns the composed aggregate object.
6010
6010
  * @example
6011
6011
  *
6012
- * _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); });
6012
+ * _.groupBy([4.2, 6.1, 6.4], function(n) {
6013
+ * return Math.floor(n);
6014
+ * });
6013
6015
  * // => { '4': [4.2], '6': [6.1, 6.4] }
6014
6016
  *
6015
- * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math);
6017
+ * _.groupBy([4.2, 6.1, 6.4], function(n) {
6018
+ * return this.floor(n);
6019
+ * }, Math);
6016
6020
  * // => { '4': [4.2], '6': [6.1, 6.4] }
6017
6021
  *
6018
- * // using the "_.property" callback shorthand
6022
+ * // using the `_.property` callback shorthand
6019
6023
  * _.groupBy(['one', 'two', 'three'], 'length');
6020
6024
  * // => { '3': ['one', 'two'], '5': ['three'] }
6021
6025
  */
@@ -6027,6 +6031,57 @@
6027
6031
  }
6028
6032
  });
6029
6033
 
6034
+ /**
6035
+ * Checks if `value` is in `collection` using `SameValueZero` for equality
6036
+ * comparisons. If `fromIndex` is negative, it is used as the offset from
6037
+ * the end of `collection`.
6038
+ *
6039
+ * **Note:** `SameValueZero` comparisons are like strict equality comparisons,
6040
+ * e.g. `===`, except that `NaN` matches `NaN`. See the
6041
+ * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
6042
+ * for more details.
6043
+ *
6044
+ * @static
6045
+ * @memberOf _
6046
+ * @alias contains, include
6047
+ * @category Collection
6048
+ * @param {Array|Object|string} collection The collection to search.
6049
+ * @param {*} target The value to search for.
6050
+ * @param {number} [fromIndex=0] The index to search from.
6051
+ * @returns {boolean} Returns `true` if a matching element is found, else `false`.
6052
+ * @example
6053
+ *
6054
+ * _.includes([1, 2, 3], 1);
6055
+ * // => true
6056
+ *
6057
+ * _.includes([1, 2, 3], 1, 2);
6058
+ * // => false
6059
+ *
6060
+ * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
6061
+ * // => true
6062
+ *
6063
+ * _.includes('pebbles', 'eb');
6064
+ * // => true
6065
+ */
6066
+ function includes(collection, target, fromIndex) {
6067
+ var length = collection ? collection.length : 0;
6068
+ if (!isLength(length)) {
6069
+ collection = values(collection);
6070
+ length = collection.length;
6071
+ }
6072
+ if (!length) {
6073
+ return false;
6074
+ }
6075
+ if (typeof fromIndex == 'number') {
6076
+ fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
6077
+ } else {
6078
+ fromIndex = 0;
6079
+ }
6080
+ return (typeof collection == 'string' || !isArray(collection) && isString(collection))
6081
+ ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1)
6082
+ : (getIndexOf(collection, target, fromIndex) > -1);
6083
+ }
6084
+
6030
6085
  /**
6031
6086
  * Creates an object composed of keys generated from the results of running
6032
6087
  * each element of `collection` through `iteratee`. The corresponding value
@@ -6034,14 +6089,14 @@
6034
6089
  * iteratee function is bound to `thisArg` and invoked with three arguments;
6035
6090
  * (value, index|key, collection).
6036
6091
  *
6037
- * If a property name is provided for `predicate` the created "_.property"
6092
+ * If a property name is provided for `predicate` the created `_.property`
6038
6093
  * style callback returns the property value of the given element.
6039
6094
  *
6040
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6095
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6041
6096
  * style callback returns `true` for elements that have a matching property
6042
6097
  * value, else `false`.
6043
6098
  *
6044
- * If an object is provided for `predicate` the created "_.matches" style
6099
+ * If an object is provided for `predicate` the created `_.matches` style
6045
6100
  * callback returns `true` for elements that have the properties of the given
6046
6101
  * object, else `false`.
6047
6102
  *
@@ -6050,8 +6105,7 @@
6050
6105
  * @category Collection
6051
6106
  * @param {Array|Object|string} collection The collection to iterate over.
6052
6107
  * @param {Function|Object|string} [iteratee=_.identity] The function invoked
6053
- * per iteration. If a property name or object is provided it is used to
6054
- * create a "_.property" or "_.matches" style callback respectively.
6108
+ * per iteration.
6055
6109
  * @param {*} [thisArg] The `this` binding of `iteratee`.
6056
6110
  * @returns {Object} Returns the composed aggregate object.
6057
6111
  * @example
@@ -6064,10 +6118,14 @@
6064
6118
  * _.indexBy(keyData, 'dir');
6065
6119
  * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
6066
6120
  *
6067
- * _.indexBy(keyData, function(object) { return String.fromCharCode(object.code); });
6121
+ * _.indexBy(keyData, function(object) {
6122
+ * return String.fromCharCode(object.code);
6123
+ * });
6068
6124
  * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
6069
6125
  *
6070
- * _.indexBy(keyData, function(object) { return this.fromCharCode(object.code); }, String);
6126
+ * _.indexBy(keyData, function(object) {
6127
+ * return this.fromCharCode(object.code);
6128
+ * }, String);
6071
6129
  * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
6072
6130
  */
6073
6131
  var indexBy = createAggregator(function(result, value, key) {
@@ -6105,14 +6163,14 @@
6105
6163
  * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
6106
6164
  * arguments; (value, index|key, collection).
6107
6165
  *
6108
- * If a property name is provided for `predicate` the created "_.property"
6166
+ * If a property name is provided for `predicate` the created `_.property`
6109
6167
  * style callback returns the property value of the given element.
6110
6168
  *
6111
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6169
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6112
6170
  * style callback returns `true` for elements that have a matching property
6113
6171
  * value, else `false`.
6114
6172
  *
6115
- * If an object is provided for `predicate` the created "_.matches" style
6173
+ * If an object is provided for `predicate` the created `_.matches` style
6116
6174
  * callback returns `true` for elements that have the properties of the given
6117
6175
  * object, else `false`.
6118
6176
  *
@@ -6131,24 +6189,28 @@
6131
6189
  * @category Collection
6132
6190
  * @param {Array|Object|string} collection The collection to iterate over.
6133
6191
  * @param {Function|Object|string} [iteratee=_.identity] The function invoked
6134
- * per iteration. If a property name or object is provided it is used to
6135
- * create a "_.property" or "_.matches" style callback respectively.
6192
+ * per iteration.
6193
+ * create a `_.property` or `_.matches` style callback respectively.
6136
6194
  * @param {*} [thisArg] The `this` binding of `iteratee`.
6137
6195
  * @returns {Array} Returns the new mapped array.
6138
6196
  * @example
6139
6197
  *
6140
- * _.map([1, 2, 3], function(n) { return n * 3; });
6141
- * // => [3, 6, 9]
6198
+ * function timesThree(n) {
6199
+ * return n * 3;
6200
+ * }
6142
6201
  *
6143
- * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(n) { return n * 3; });
6144
- * // => [3, 6, 9] (iteration order is not guaranteed)
6202
+ * _.map([1, 2], timesThree);
6203
+ * // => [3, 6]
6204
+ *
6205
+ * _.map({ 'a': 1, 'b': 2 }, timesThree);
6206
+ * // => [3, 6] (iteration order is not guaranteed)
6145
6207
  *
6146
6208
  * var users = [
6147
6209
  * { 'user': 'barney' },
6148
6210
  * { 'user': 'fred' }
6149
6211
  * ];
6150
6212
  *
6151
- * // using the "_.property" callback shorthand
6213
+ * // using the `_.property` callback shorthand
6152
6214
  * _.map(users, 'user');
6153
6215
  * // => ['barney', 'fred']
6154
6216
  */
@@ -6165,14 +6227,14 @@
6165
6227
  * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
6166
6228
  * arguments; (value, index, collection).
6167
6229
  *
6168
- * If a property name is provided for `predicate` the created "_.property"
6230
+ * If a property name is provided for `predicate` the created `_.property`
6169
6231
  * style callback returns the property value of the given element.
6170
6232
  *
6171
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6233
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6172
6234
  * style callback returns `true` for elements that have a matching property
6173
6235
  * value, else `false`.
6174
6236
  *
6175
- * If an object is provided for `predicate` the created "_.matches" style
6237
+ * If an object is provided for `predicate` the created `_.matches` style
6176
6238
  * callback returns `true` for elements that have the properties of the given
6177
6239
  * object, else `false`.
6178
6240
  *
@@ -6181,8 +6243,6 @@
6181
6243
  * @category Collection
6182
6244
  * @param {Array|Object|string} collection The collection to iterate over.
6183
6245
  * @param {Function|Object|string} [iteratee] The function invoked per iteration.
6184
- * If a property name or object is provided it is used to create a "_.property"
6185
- * or "_.matches" style callback respectively.
6186
6246
  * @param {*} [thisArg] The `this` binding of `iteratee`.
6187
6247
  * @returns {*} Returns the maximum value.
6188
6248
  * @example
@@ -6198,10 +6258,12 @@
6198
6258
  * { 'user': 'fred', 'age': 40 }
6199
6259
  * ];
6200
6260
  *
6201
- * _.max(users, function(chr) { return chr.age; });
6261
+ * _.max(users, function(chr) {
6262
+ * return chr.age;
6263
+ * });
6202
6264
  * // => { 'user': 'fred', 'age': 40 };
6203
6265
  *
6204
- * // using the "_.property" callback shorthand
6266
+ * // using the `_.property` callback shorthand
6205
6267
  * _.max(users, 'age');
6206
6268
  * // => { 'user': 'fred', 'age': 40 };
6207
6269
  */
@@ -6214,14 +6276,14 @@
6214
6276
  * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
6215
6277
  * arguments; (value, index, collection).
6216
6278
  *
6217
- * If a property name is provided for `predicate` the created "_.property"
6279
+ * If a property name is provided for `predicate` the created `_.property`
6218
6280
  * style callback returns the property value of the given element.
6219
6281
  *
6220
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6282
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6221
6283
  * style callback returns `true` for elements that have a matching property
6222
6284
  * value, else `false`.
6223
6285
  *
6224
- * If an object is provided for `predicate` the created "_.matches" style
6286
+ * If an object is provided for `predicate` the created `_.matches` style
6225
6287
  * callback returns `true` for elements that have the properties of the given
6226
6288
  * object, else `false`.
6227
6289
  *
@@ -6230,8 +6292,6 @@
6230
6292
  * @category Collection
6231
6293
  * @param {Array|Object|string} collection The collection to iterate over.
6232
6294
  * @param {Function|Object|string} [iteratee] The function invoked per iteration.
6233
- * If a property name or object is provided it is used to create a "_.property"
6234
- * or "_.matches" style callback respectively.
6235
6295
  * @param {*} [thisArg] The `this` binding of `iteratee`.
6236
6296
  * @returns {*} Returns the minimum value.
6237
6297
  * @example
@@ -6247,10 +6307,12 @@
6247
6307
  * { 'user': 'fred', 'age': 40 }
6248
6308
  * ];
6249
6309
  *
6250
- * _.min(users, function(chr) { return chr.age; });
6310
+ * _.min(users, function(chr) {
6311
+ * return chr.age;
6312
+ * });
6251
6313
  * // => { 'user': 'barney', 'age': 36 };
6252
6314
  *
6253
- * // using the "_.property" callback shorthand
6315
+ * // using the `_.property` callback shorthand
6254
6316
  * _.min(users, 'age');
6255
6317
  * // => { 'user': 'barney', 'age': 36 };
6256
6318
  */
@@ -6262,14 +6324,14 @@
6262
6324
  * contains elements `predicate` returns falsey for. The predicate is bound
6263
6325
  * to `thisArg` and invoked with three arguments; (value, index|key, collection).
6264
6326
  *
6265
- * If a property name is provided for `predicate` the created "_.property"
6327
+ * If a property name is provided for `predicate` the created `_.property`
6266
6328
  * style callback returns the property value of the given element.
6267
6329
  *
6268
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6330
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6269
6331
  * style callback returns `true` for elements that have a matching property
6270
6332
  * value, else `false`.
6271
6333
  *
6272
- * If an object is provided for `predicate` the created "_.matches" style
6334
+ * If an object is provided for `predicate` the created `_.matches` style
6273
6335
  * callback returns `true` for elements that have the properties of the given
6274
6336
  * object, else `false`.
6275
6337
  *
@@ -6278,16 +6340,19 @@
6278
6340
  * @category Collection
6279
6341
  * @param {Array|Object|string} collection The collection to iterate over.
6280
6342
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
6281
- * per iteration. If a property name or object is provided it is used to
6282
- * create a "_.property" or "_.matches" style callback respectively.
6343
+ * per iteration.
6283
6344
  * @param {*} [thisArg] The `this` binding of `predicate`.
6284
6345
  * @returns {Array} Returns the array of grouped elements.
6285
6346
  * @example
6286
6347
  *
6287
- * _.partition([1, 2, 3], function(n) { return n % 2; });
6348
+ * _.partition([1, 2, 3], function(n) {
6349
+ * return n % 2;
6350
+ * });
6288
6351
  * // => [[1, 3], [2]]
6289
6352
  *
6290
- * _.partition([1.2, 2.3, 3.4], function(n) { return this.floor(n) % 2; }, Math);
6353
+ * _.partition([1.2, 2.3, 3.4], function(n) {
6354
+ * return this.floor(n) % 2;
6355
+ * }, Math);
6291
6356
  * // => [[1, 3], [2]]
6292
6357
  *
6293
6358
  * var users = [
@@ -6296,17 +6361,19 @@
6296
6361
  * { 'user': 'pebbles', 'age': 1, 'active': false }
6297
6362
  * ];
6298
6363
  *
6299
- * var mapper = function(array) { return _.pluck(array, 'user'); };
6364
+ * var mapper = function(array) {
6365
+ * return _.pluck(array, 'user');
6366
+ * };
6300
6367
  *
6301
- * // using the "_.matches" callback shorthand
6368
+ * // using the `_.matches` callback shorthand
6302
6369
  * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper);
6303
6370
  * // => [['pebbles'], ['barney', 'fred']]
6304
6371
  *
6305
- * // using the "_.matchesProperty" callback shorthand
6372
+ * // using the `_.matchesProperty` callback shorthand
6306
6373
  * _.map(_.partition(users, 'active', false), mapper);
6307
6374
  * // => [['barney', 'pebbles'], ['fred']]
6308
6375
  *
6309
- * // using the "_.property" callback shorthand
6376
+ * // using the `_.property` callback shorthand
6310
6377
  * _.map(_.partition(users, 'active'), mapper);
6311
6378
  * // => [['fred'], ['barney', 'pebbles']]
6312
6379
  */
@@ -6366,14 +6433,16 @@
6366
6433
  * @returns {*} Returns the accumulated value.
6367
6434
  * @example
6368
6435
  *
6369
- * var sum = _.reduce([1, 2, 3], function(sum, n) { return sum + n; });
6370
- * // => 6
6436
+ * _.reduce([1, 2], function(sum, n) {
6437
+ * return sum + n;
6438
+ * });
6439
+ * // => 3
6371
6440
  *
6372
- * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, n, key) {
6441
+ * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {
6373
6442
  * result[key] = n * 3;
6374
6443
  * return result;
6375
6444
  * }, {});
6376
- * // => { 'a': 3, 'b': 6, 'c': 9 } (iteration order is not guaranteed)
6445
+ * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)
6377
6446
  */
6378
6447
  function reduce(collection, iteratee, accumulator, thisArg) {
6379
6448
  var func = isArray(collection) ? arrayReduce : baseReduce;
@@ -6396,7 +6465,10 @@
6396
6465
  * @example
6397
6466
  *
6398
6467
  * var array = [[0, 1], [2, 3], [4, 5]];
6399
- * _.reduceRight(array, function(flattened, other) { return flattened.concat(other); }, []);
6468
+ *
6469
+ * _.reduceRight(array, function(flattened, other) {
6470
+ * return flattened.concat(other);
6471
+ * }, []);
6400
6472
  * // => [4, 5, 2, 3, 0, 1]
6401
6473
  */
6402
6474
  function reduceRight(collection, iteratee, accumulator, thisArg) {
@@ -6408,14 +6480,14 @@
6408
6480
  * The opposite of `_.filter`; this method returns the elements of `collection`
6409
6481
  * that `predicate` does **not** return truthy for.
6410
6482
  *
6411
- * If a property name is provided for `predicate` the created "_.property"
6483
+ * If a property name is provided for `predicate` the created `_.property`
6412
6484
  * style callback returns the property value of the given element.
6413
6485
  *
6414
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6486
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6415
6487
  * style callback returns `true` for elements that have a matching property
6416
6488
  * value, else `false`.
6417
6489
  *
6418
- * If an object is provided for `predicate` the created "_.matches" style
6490
+ * If an object is provided for `predicate` the created `_.matches` style
6419
6491
  * callback returns `true` for elements that have the properties of the given
6420
6492
  * object, else `false`.
6421
6493
  *
@@ -6424,13 +6496,14 @@
6424
6496
  * @category Collection
6425
6497
  * @param {Array|Object|string} collection The collection to iterate over.
6426
6498
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
6427
- * per iteration. If a property name or object is provided it is used to
6428
- * create a "_.property" or "_.matches" style callback respectively.
6499
+ * per iteration.
6429
6500
  * @param {*} [thisArg] The `this` binding of `predicate`.
6430
6501
  * @returns {Array} Returns the new filtered array.
6431
6502
  * @example
6432
6503
  *
6433
- * var odds = _.reject([1, 2, 3, 4], function(n) { return n % 2 == 0; });
6504
+ * _.reject([1, 2, 3, 4], function(n) {
6505
+ * return n % 2 == 0;
6506
+ * });
6434
6507
  * // => [1, 3]
6435
6508
  *
6436
6509
  * var users = [
@@ -6438,15 +6511,15 @@
6438
6511
  * { 'user': 'fred', 'age': 40, 'active': true }
6439
6512
  * ];
6440
6513
  *
6441
- * // using the "_.matches" callback shorthand
6514
+ * // using the `_.matches` callback shorthand
6442
6515
  * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');
6443
6516
  * // => ['barney']
6444
6517
  *
6445
- * // using the "_.matchesProperty" callback shorthand
6518
+ * // using the `_.matchesProperty` callback shorthand
6446
6519
  * _.pluck(_.reject(users, 'active', false), 'user');
6447
6520
  * // => ['fred']
6448
6521
  *
6449
- * // using the "_.property" callback shorthand
6522
+ * // using the `_.property` callback shorthand
6450
6523
  * _.pluck(_.reject(users, 'active'), 'user');
6451
6524
  * // => ['barney']
6452
6525
  */
@@ -6530,12 +6603,12 @@
6530
6603
  * @returns {number} Returns the size of `collection`.
6531
6604
  * @example
6532
6605
  *
6533
- * _.size([1, 2]);
6534
- * // => 2
6535
- *
6536
- * _.size({ 'one': 1, 'two': 2, 'three': 3 });
6606
+ * _.size([1, 2, 3]);
6537
6607
  * // => 3
6538
6608
  *
6609
+ * _.size({ 'a': 1, 'b': 2 });
6610
+ * // => 2
6611
+ *
6539
6612
  * _.size('pebbles');
6540
6613
  * // => 7
6541
6614
  */
@@ -6550,14 +6623,14 @@
6550
6623
  * over the entire collection. The predicate is bound to `thisArg` and invoked
6551
6624
  * with three arguments; (value, index|key, collection).
6552
6625
  *
6553
- * If a property name is provided for `predicate` the created "_.property"
6626
+ * If a property name is provided for `predicate` the created `_.property`
6554
6627
  * style callback returns the property value of the given element.
6555
6628
  *
6556
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6629
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6557
6630
  * style callback returns `true` for elements that have a matching property
6558
6631
  * value, else `false`.
6559
6632
  *
6560
- * If an object is provided for `predicate` the created "_.matches" style
6633
+ * If an object is provided for `predicate` the created `_.matches` style
6561
6634
  * callback returns `true` for elements that have the properties of the given
6562
6635
  * object, else `false`.
6563
6636
  *
@@ -6567,8 +6640,7 @@
6567
6640
  * @category Collection
6568
6641
  * @param {Array|Object|string} collection The collection to iterate over.
6569
6642
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
6570
- * per iteration. If a property name or object is provided it is used to
6571
- * create a "_.property" or "_.matches" style callback respectively.
6643
+ * per iteration.
6572
6644
  * @param {*} [thisArg] The `this` binding of `predicate`.
6573
6645
  * @returns {boolean} Returns `true` if any element passes the predicate check,
6574
6646
  * else `false`.
@@ -6578,19 +6650,19 @@
6578
6650
  * // => true
6579
6651
  *
6580
6652
  * var users = [
6581
- * { 'user': 'barney', 'age': 36, 'active': false },
6582
- * { 'user': 'fred', 'age': 40, 'active': true }
6653
+ * { 'user': 'barney', 'active': true },
6654
+ * { 'user': 'fred', 'active': false }
6583
6655
  * ];
6584
6656
  *
6585
- * // using the "_.matches" callback shorthand
6586
- * _.some(users, { 'age': 1, 'active': true });
6657
+ * // using the `_.matches` callback shorthand
6658
+ * _.some(users, { user': 'barney', 'active': false });
6587
6659
  * // => false
6588
6660
  *
6589
- * // using the "_.matchesProperty" callback shorthand
6661
+ * // using the `_.matchesProperty` callback shorthand
6590
6662
  * _.some(users, 'active', false);
6591
6663
  * // => true
6592
6664
  *
6593
- * // using the "_.property" callback shorthand
6665
+ * // using the `_.property` callback shorthand
6594
6666
  * _.some(users, 'active');
6595
6667
  * // => true
6596
6668
  */
@@ -6609,14 +6681,14 @@
6609
6681
  * The `iteratee` is bound to `thisArg` and invoked with three arguments;
6610
6682
  * (value, index|key, collection).
6611
6683
  *
6612
- * If a property name is provided for `predicate` the created "_.property"
6684
+ * If a property name is provided for `predicate` the created `_.property`
6613
6685
  * style callback returns the property value of the given element.
6614
6686
  *
6615
- * If value is also provided for `thisArg` the created "_.matchesProperty"
6687
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
6616
6688
  * style callback returns `true` for elements that have a matching property
6617
6689
  * value, else `false`.
6618
6690
  *
6619
- * If an object is provided for `predicate` the created "_.matches" style
6691
+ * If an object is provided for `predicate` the created `_.matches` style
6620
6692
  * callback returns `true` for elements that have the properties of the given
6621
6693
  * object, else `false`.
6622
6694
  *
@@ -6626,15 +6698,19 @@
6626
6698
  * @param {Array|Object|string} collection The collection to iterate over.
6627
6699
  * @param {Array|Function|Object|string} [iteratee=_.identity] The function
6628
6700
  * invoked per iteration. If a property name or an object is provided it is
6629
- * used to create a "_.property" or "_.matches" style callback respectively.
6701
+ * used to create a `_.property` or `_.matches` style callback respectively.
6630
6702
  * @param {*} [thisArg] The `this` binding of `iteratee`.
6631
6703
  * @returns {Array} Returns the new sorted array.
6632
6704
  * @example
6633
6705
  *
6634
- * _.sortBy([1, 2, 3], function(n) { return Math.sin(n); });
6706
+ * _.sortBy([1, 2, 3], function(n) {
6707
+ * return Math.sin(n);
6708
+ * });
6635
6709
  * // => [3, 1, 2]
6636
6710
  *
6637
- * _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math);
6711
+ * _.sortBy([1, 2, 3], function(n) {
6712
+ * return this.sin(n);
6713
+ * }, Math);
6638
6714
  * // => [3, 1, 2]
6639
6715
  *
6640
6716
  * var users = [
@@ -6643,7 +6719,7 @@
6643
6719
  * { 'user': 'barney' }
6644
6720
  * ];
6645
6721
  *
6646
- * // using the "_.property" callback shorthand
6722
+ * // using the `_.property` callback shorthand
6647
6723
  * _.pluck(_.sortBy(users, 'user'), 'user');
6648
6724
  * // => ['barney', 'fred', 'pebbles']
6649
6725
  */
@@ -6751,7 +6827,9 @@
6751
6827
  * @category Date
6752
6828
  * @example
6753
6829
  *
6754
- * _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now());
6830
+ * _.defer(function(stamp) {
6831
+ * console.log(_.now() - stamp);
6832
+ * }, _.now());
6755
6833
  * // => logs the number of milliseconds it took for the deferred function to be invoked
6756
6834
  */
6757
6835
  var now = nativeNow || function() {
@@ -6927,7 +7005,9 @@
6927
7005
  *
6928
7006
  * var view = {
6929
7007
  * 'label': 'docs',
6930
- * 'onClick': function() { console.log('clicked ' + this.label); }
7008
+ * 'onClick': function() {
7009
+ * console.log('clicked ' + this.label);
7010
+ * }
6931
7011
  * };
6932
7012
  *
6933
7013
  * _.bindAll(view);
@@ -7280,7 +7360,9 @@
7280
7360
  * @returns {number} Returns the timer id.
7281
7361
  * @example
7282
7362
  *
7283
- * _.defer(function(text) { console.log(text); }, 'deferred');
7363
+ * _.defer(function(text) {
7364
+ * console.log(text);
7365
+ * }, 'deferred');
7284
7366
  * // logs 'deferred' after one or more milliseconds
7285
7367
  */
7286
7368
  function defer(func) {
@@ -7300,7 +7382,9 @@
7300
7382
  * @returns {number} Returns the timer id.
7301
7383
  * @example
7302
7384
  *
7303
- * _.delay(function(text) { console.log(text); }, 1000, 'later');
7385
+ * _.delay(function(text) {
7386
+ * console.log(text);
7387
+ * }, 1000, 'later');
7304
7388
  * // => logs 'later' after one second
7305
7389
  */
7306
7390
  function delay(func, wait) {
@@ -7338,7 +7422,7 @@
7338
7422
  if (!length) {
7339
7423
  return function() { return arguments[0]; };
7340
7424
  }
7341
- if (!arrayEvery(funcs, isFunction)) {
7425
+ if (!arrayEvery(funcs, baseIsFunction)) {
7342
7426
  throw new TypeError(FUNC_ERROR_TEXT);
7343
7427
  }
7344
7428
  return function() {
@@ -7383,7 +7467,7 @@
7383
7467
  if (fromIndex < 0) {
7384
7468
  return function() { return arguments[0]; };
7385
7469
  }
7386
- if (!arrayEvery(funcs, isFunction)) {
7470
+ if (!arrayEvery(funcs, baseIsFunction)) {
7387
7471
  throw new TypeError(FUNC_ERROR_TEXT);
7388
7472
  }
7389
7473
  return function() {
@@ -7618,7 +7702,9 @@
7618
7702
  * // => ['a', 'b', 'c']
7619
7703
  *
7620
7704
  * var map = _.rearg(_.map, [1, 0]);
7621
- * map(function(n) { return n * 3; }, [1, 2, 3]);
7705
+ * map(function(n) {
7706
+ * return n * 3;
7707
+ * }, [1, 2, 3]);
7622
7708
  * // => [3, 6, 9]
7623
7709
  */
7624
7710
  function rearg(func) {
@@ -7697,8 +7783,9 @@
7697
7783
  * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
7698
7784
  *
7699
7785
  * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
7700
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false })
7701
- * jQuery('.interactive').on('click', throttled);
7786
+ * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
7787
+ * 'trailing': false
7788
+ * }));
7702
7789
  *
7703
7790
  * // cancel a trailing throttled call
7704
7791
  * jQuery(window).on('popstate', throttled.cancel);
@@ -7788,22 +7875,26 @@
7788
7875
  * // => false
7789
7876
  *
7790
7877
  * // using a customizer callback
7791
- * var body = _.clone(document.body, function(value) {
7792
- * return _.isElement(value) ? value.cloneNode(false) : undefined;
7878
+ * var el = _.clone(document.body, function(value) {
7879
+ * if (_.isElement(value)) {
7880
+ * return value.cloneNode(false);
7881
+ * }
7793
7882
  * });
7794
7883
  *
7795
- * body === document.body
7884
+ * el === document.body
7796
7885
  * // => false
7797
- * body.nodeName
7886
+ * el.nodeName
7798
7887
  * // => BODY
7799
- * body.childNodes.length;
7888
+ * el.childNodes.length;
7800
7889
  * // => 0
7801
7890
  */
7802
7891
  function clone(value, isDeep, customizer, thisArg) {
7803
- // Juggle arguments.
7804
- if (typeof isDeep != 'boolean' && isDeep != null) {
7892
+ if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
7893
+ isDeep = false;
7894
+ }
7895
+ else if (typeof isDeep == 'function') {
7805
7896
  thisArg = customizer;
7806
- customizer = isIterateeCall(value, isDeep, thisArg) ? null : isDeep;
7897
+ customizer = isDeep;
7807
7898
  isDeep = false;
7808
7899
  }
7809
7900
  customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1);
@@ -7843,14 +7934,16 @@
7843
7934
  *
7844
7935
  * // using a customizer callback
7845
7936
  * var el = _.cloneDeep(document.body, function(value) {
7846
- * return _.isElement(value) ? value.cloneNode(true) : undefined;
7937
+ * if (_.isElement(value)) {
7938
+ * return value.cloneNode(true);
7939
+ * }
7847
7940
  * });
7848
7941
  *
7849
- * body === document.body
7942
+ * el === document.body
7850
7943
  * // => false
7851
- * body.nodeName
7944
+ * el.nodeName
7852
7945
  * // => BODY
7853
- * body.childNodes.length;
7946
+ * el.childNodes.length;
7854
7947
  * // => 20
7855
7948
  */
7856
7949
  function cloneDeep(value, customizer, thisArg) {
@@ -7868,7 +7961,7 @@
7868
7961
  * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
7869
7962
  * @example
7870
7963
  *
7871
- * (function() { return _.isArguments(arguments); })();
7964
+ * _.isArguments(function() { return arguments; }());
7872
7965
  * // => true
7873
7966
  *
7874
7967
  * _.isArguments([1, 2, 3]);
@@ -7892,7 +7985,7 @@
7892
7985
  * _.isArray([1, 2, 3]);
7893
7986
  * // => true
7894
7987
  *
7895
- * (function() { return _.isArray(arguments); })();
7988
+ * _.isArray(function() { return arguments; }());
7896
7989
  * // => false
7897
7990
  */
7898
7991
  var isArray = nativeIsArray || function(value) {
@@ -8042,7 +8135,9 @@
8042
8135
  * var other = ['hi', 'goodbye'];
8043
8136
  *
8044
8137
  * _.isEqual(array, other, function(value, other) {
8045
- * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
8138
+ * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
8139
+ * return true;
8140
+ * }
8046
8141
  * });
8047
8142
  * // => true
8048
8143
  */
@@ -8125,20 +8220,12 @@
8125
8220
  * _.isFunction(/abc/);
8126
8221
  * // => false
8127
8222
  */
8128
- function isFunction(value) {
8129
- // Avoid a Chakra JIT bug in compatibility modes of IE 11.
8130
- // See https://github.com/jashkenas/underscore/issues/1621 for more details.
8131
- return typeof value == 'function' || false;
8132
- }
8133
- // Fallback for environments that return incorrect `typeof` operator results.
8134
- if (isFunction(/x/) || (Uint8Array && !isFunction(Uint8Array))) {
8135
- isFunction = function(value) {
8136
- // The use of `Object#toString` avoids issues with the `typeof` operator
8137
- // in older versions of Chrome and Safari which return 'function' for regexes
8138
- // and Safari 8 equivalents which return 'object' for typed array constructors.
8139
- return objToString.call(value) == funcTag;
8140
- };
8141
- }
8223
+ var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) {
8224
+ // The use of `Object#toString` avoids issues with the `typeof` operator
8225
+ // in older versions of Chrome and Safari which return 'function' for regexes
8226
+ // and Safari 8 equivalents which return 'object' for typed array constructors.
8227
+ return objToString.call(value) == funcTag;
8228
+ };
8142
8229
 
8143
8230
  /**
8144
8231
  * Checks if `value` is the language type of `Object`.
@@ -8467,7 +8554,9 @@
8467
8554
  * @returns {Array} Returns the converted array.
8468
8555
  * @example
8469
8556
  *
8470
- * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3);
8557
+ * (function() {
8558
+ * return _.toArray(arguments).slice(1);
8559
+ * }(1, 2, 3));
8471
8560
  * // => [2, 3]
8472
8561
  */
8473
8562
  function toArray(value) {
@@ -8564,7 +8653,9 @@
8564
8653
  * Shape.call(this);
8565
8654
  * }
8566
8655
  *
8567
- * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle });
8656
+ * Circle.prototype = _.create(Shape.prototype, {
8657
+ * 'constructor': Circle
8658
+ * });
8568
8659
  *
8569
8660
  * var circle = new Circle;
8570
8661
  * circle instanceof Circle;
@@ -8610,14 +8701,14 @@
8610
8701
  * This method is like `_.findIndex` except that it returns the key of the
8611
8702
  * first element `predicate` returns truthy for, instead of the element itself.
8612
8703
  *
8613
- * If a property name is provided for `predicate` the created "_.property"
8704
+ * If a property name is provided for `predicate` the created `_.property`
8614
8705
  * style callback returns the property value of the given element.
8615
8706
  *
8616
- * If value is also provided for `thisArg` the created "_.matchesProperty"
8707
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
8617
8708
  * style callback returns `true` for elements that have a matching property
8618
8709
  * value, else `false`.
8619
8710
  *
8620
- * If an object is provided for `predicate` the created "_.matches" style
8711
+ * If an object is provided for `predicate` the created `_.matches` style
8621
8712
  * callback returns `true` for elements that have the properties of the given
8622
8713
  * object, else `false`.
8623
8714
  *
@@ -8626,8 +8717,7 @@
8626
8717
  * @category Object
8627
8718
  * @param {Object} object The object to search.
8628
8719
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
8629
- * per iteration. If a property name or object is provided it is used to
8630
- * create a "_.property" or "_.matches" style callback respectively.
8720
+ * per iteration.
8631
8721
  * @param {*} [thisArg] The `this` binding of `predicate`.
8632
8722
  * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
8633
8723
  * @example
@@ -8638,18 +8728,20 @@
8638
8728
  * 'pebbles': { 'age': 1, 'active': true }
8639
8729
  * };
8640
8730
  *
8641
- * _.findKey(users, function(chr) { return chr.age < 40; });
8731
+ * _.findKey(users, function(chr) {
8732
+ * return chr.age < 40;
8733
+ * });
8642
8734
  * // => 'barney' (iteration order is not guaranteed)
8643
8735
  *
8644
- * // using the "_.matches" callback shorthand
8736
+ * // using the `_.matches` callback shorthand
8645
8737
  * _.findKey(users, { 'age': 1, 'active': true });
8646
8738
  * // => 'pebbles'
8647
8739
  *
8648
- * // using the "_.matchesProperty" callback shorthand
8740
+ * // using the `_.matchesProperty` callback shorthand
8649
8741
  * _.findKey(users, 'active', false);
8650
8742
  * // => 'fred'
8651
8743
  *
8652
- * // using the "_.property" callback shorthand
8744
+ * // using the `_.property` callback shorthand
8653
8745
  * _.findKey(users, 'active');
8654
8746
  * // => 'barney'
8655
8747
  */
@@ -8662,14 +8754,14 @@
8662
8754
  * This method is like `_.findKey` except that it iterates over elements of
8663
8755
  * a collection in the opposite order.
8664
8756
  *
8665
- * If a property name is provided for `predicate` the created "_.property"
8757
+ * If a property name is provided for `predicate` the created `_.property`
8666
8758
  * style callback returns the property value of the given element.
8667
8759
  *
8668
- * If value is also provided for `thisArg` the created "_.matchesProperty"
8760
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
8669
8761
  * style callback returns `true` for elements that have a matching property
8670
8762
  * value, else `false`.
8671
8763
  *
8672
- * If an object is provided for `predicate` the created "_.matches" style
8764
+ * If an object is provided for `predicate` the created `_.matches` style
8673
8765
  * callback returns `true` for elements that have the properties of the given
8674
8766
  * object, else `false`.
8675
8767
  *
@@ -8678,8 +8770,7 @@
8678
8770
  * @category Object
8679
8771
  * @param {Object} object The object to search.
8680
8772
  * @param {Function|Object|string} [predicate=_.identity] The function invoked
8681
- * per iteration. If a property name or object is provided it is used to
8682
- * create a "_.property" or "_.matches" style callback respectively.
8773
+ * per iteration.
8683
8774
  * @param {*} [thisArg] The `this` binding of `predicate`.
8684
8775
  * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
8685
8776
  * @example
@@ -8690,18 +8781,20 @@
8690
8781
  * 'pebbles': { 'age': 1, 'active': true }
8691
8782
  * };
8692
8783
  *
8693
- * _.findLastKey(users, function(chr) { return chr.age < 40; });
8784
+ * _.findLastKey(users, function(chr) {
8785
+ * return chr.age < 40;
8786
+ * });
8694
8787
  * // => returns `pebbles` assuming `_.findKey` returns `barney`
8695
8788
  *
8696
- * // using the "_.matches" callback shorthand
8789
+ * // using the `_.matches` callback shorthand
8697
8790
  * _.findLastKey(users, { 'age': 36, 'active': true });
8698
8791
  * // => 'barney'
8699
8792
  *
8700
- * // using the "_.matchesProperty" callback shorthand
8793
+ * // using the `_.matchesProperty` callback shorthand
8701
8794
  * _.findLastKey(users, 'active', false);
8702
8795
  * // => 'fred'
8703
8796
  *
8704
- * // using the "_.property" callback shorthand
8797
+ * // using the `_.property` callback shorthand
8705
8798
  * _.findLastKey(users, 'active');
8706
8799
  * // => 'pebbles'
8707
8800
  */
@@ -8789,10 +8882,17 @@
8789
8882
  * @returns {Object} Returns `object`.
8790
8883
  * @example
8791
8884
  *
8792
- * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(n, key) {
8885
+ * function Foo() {
8886
+ * this.a = 1;
8887
+ * this.b = 2;
8888
+ * }
8889
+ *
8890
+ * Foo.prototype.c = 3;
8891
+ *
8892
+ * _.forOwn(new Foo, function(value, key) {
8793
8893
  * console.log(key);
8794
8894
  * });
8795
- * // => logs '0', '1', and 'length' (iteration order is not guaranteed)
8895
+ * // => logs 'a' and 'b' (iteration order is not guaranteed)
8796
8896
  */
8797
8897
  function forOwn(object, iteratee, thisArg) {
8798
8898
  if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
@@ -8814,10 +8914,17 @@
8814
8914
  * @returns {Object} Returns `object`.
8815
8915
  * @example
8816
8916
  *
8817
- * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(n, key) {
8917
+ * function Foo() {
8918
+ * this.a = 1;
8919
+ * this.b = 2;
8920
+ * }
8921
+ *
8922
+ * Foo.prototype.c = 3;
8923
+ *
8924
+ * _.forOwnRight(new Foo, function(value, key) {
8818
8925
  * console.log(key);
8819
8926
  * });
8820
- * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length'
8927
+ * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
8821
8928
  */
8822
8929
  function forOwnRight(object, iteratee, thisArg) {
8823
8930
  iteratee = bindCallback(iteratee, thisArg, 3);
@@ -8837,7 +8944,7 @@
8837
8944
  * @example
8838
8945
  *
8839
8946
  * _.functions(_);
8840
- * // => ['all', 'any', 'bind', ...]
8947
+ * // => ['after', 'ary', 'assign', ...]
8841
8948
  */
8842
8949
  function functions(object) {
8843
8950
  return baseFunctions(object, keysIn(object));
@@ -8855,7 +8962,9 @@
8855
8962
  * @returns {boolean} Returns `true` if `key` is a direct property, else `false`.
8856
8963
  * @example
8857
8964
  *
8858
- * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
8965
+ * var object = { 'a': 1, 'b': 2, 'c': 3 };
8966
+ *
8967
+ * _.has(object, 'b');
8859
8968
  * // => true
8860
8969
  */
8861
8970
  function has(object, key) {
@@ -8876,16 +8985,14 @@
8876
8985
  * @returns {Object} Returns the new inverted object.
8877
8986
  * @example
8878
8987
  *
8879
- * _.invert({ 'first': 'fred', 'second': 'barney' });
8880
- * // => { 'fred': 'first', 'barney': 'second' }
8988
+ * var object = { 'a': 1, 'b': 2, 'c': 1 };
8881
8989
  *
8882
- * // without `multiValue`
8883
- * _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' });
8884
- * // => { 'fred': 'third', 'barney': 'second' }
8990
+ * _.invert(object);
8991
+ * // => { '1': 'c', '2': 'b' }
8885
8992
  *
8886
8993
  * // with `multiValue`
8887
- * _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }, true);
8888
- * // => { 'fred': ['first', 'third'], 'barney': ['second'] }
8994
+ * _.invert(object, true);
8995
+ * // => { '1': ['a', 'c'], '2': ['b'] }
8889
8996
  */
8890
8997
  function invert(object, multiValue, guard) {
8891
8998
  if (guard && isIterateeCall(object, multiValue, guard)) {
@@ -9010,14 +9117,14 @@
9010
9117
  * iteratee function is bound to `thisArg` and invoked with three arguments;
9011
9118
  * (value, key, object).
9012
9119
  *
9013
- * If a property name is provided for `iteratee` the created "_.property"
9120
+ * If a property name is provided for `iteratee` the created `_.property`
9014
9121
  * style callback returns the property value of the given element.
9015
9122
  *
9016
- * If value is also provided for `thisArg` the created "_.matchesProperty"
9123
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
9017
9124
  * style callback returns `true` for elements that have a matching property
9018
9125
  * value, else `false`.
9019
9126
  *
9020
- * If an object is provided for `iteratee` the created "_.matches" style
9127
+ * If an object is provided for `iteratee` the created `_.matches` style
9021
9128
  * callback returns `true` for elements that have the properties of the given
9022
9129
  * object, else `false`.
9023
9130
  *
@@ -9026,21 +9133,22 @@
9026
9133
  * @category Object
9027
9134
  * @param {Object} object The object to iterate over.
9028
9135
  * @param {Function|Object|string} [iteratee=_.identity] The function invoked
9029
- * per iteration. If a property name or object is provided it is used to
9030
- * create a "_.property" or "_.matches" style callback respectively.
9136
+ * per iteration.
9031
9137
  * @param {*} [thisArg] The `this` binding of `iteratee`.
9032
9138
  * @returns {Object} Returns the new mapped object.
9033
9139
  * @example
9034
9140
  *
9035
- * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(n) { return n * 3; });
9036
- * // => { 'a': 3, 'b': 6, 'c': 9 }
9141
+ * _.mapValues({ 'a': 1, 'b': 2 }, function(n) {
9142
+ * return n * 3;
9143
+ * });
9144
+ * // => { 'a': 3, 'b': 6 }
9037
9145
  *
9038
9146
  * var users = {
9039
9147
  * 'fred': { 'user': 'fred', 'age': 40 },
9040
9148
  * 'pebbles': { 'user': 'pebbles', 'age': 1 }
9041
9149
  * };
9042
9150
  *
9043
- * // using the "_.property" callback shorthand
9151
+ * // using the `_.property` callback shorthand
9044
9152
  * _.mapValues(users, 'age');
9045
9153
  * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
9046
9154
  */
@@ -9096,7 +9204,9 @@
9096
9204
  * };
9097
9205
  *
9098
9206
  * _.merge(object, other, function(a, b) {
9099
- * return _.isArray(a) ? a.concat(b) : undefined;
9207
+ * if (_.isArray(a)) {
9208
+ * return a.concat(b);
9209
+ * }
9100
9210
  * });
9101
9211
  * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
9102
9212
  */
@@ -9262,18 +9372,16 @@
9262
9372
  * @returns {*} Returns the accumulated value.
9263
9373
  * @example
9264
9374
  *
9265
- * var squares = _.transform([1, 2, 3, 4, 5, 6], function(result, n) {
9266
- * n *= n;
9267
- * if (n % 2) {
9268
- * return result.push(n) < 3;
9269
- * }
9375
+ * _.transform([2, 3, 4], function(result, n) {
9376
+ * result.push(n *= n);
9377
+ * return n % 2 == 0;
9270
9378
  * });
9271
- * // => [1, 9, 25]
9379
+ * // => [4, 9]
9272
9380
  *
9273
- * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, n, key) {
9381
+ * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {
9274
9382
  * result[key] = n * 3;
9275
9383
  * });
9276
- * // => { 'a': 3, 'b': 6, 'c': 9 }
9384
+ * // => { 'a': 3, 'b': 6 }
9277
9385
  */
9278
9386
  function transform(object, iteratee, accumulator, thisArg) {
9279
9387
  var isArr = isArray(object) || isTypedArray(object);
@@ -9355,6 +9463,48 @@
9355
9463
 
9356
9464
  /*------------------------------------------------------------------------*/
9357
9465
 
9466
+ /**
9467
+ * Checks if `n` is between `start` and up to but not including, `end`. If
9468
+ * `end` is not specified it defaults to `start` with `start` becoming `0`.
9469
+ *
9470
+ * @static
9471
+ * @memberOf _
9472
+ * @category Number
9473
+ * @param {number} n The number to check.
9474
+ * @param {number} [start=0] The start of the range.
9475
+ * @param {number} end The end of the range.
9476
+ * @returns {boolean} Returns `true` if `n` is in the range, else `false`.
9477
+ * @example
9478
+ *
9479
+ * _.inRange(3, 2, 4);
9480
+ * // => true
9481
+ *
9482
+ * _.inRange(4, 8);
9483
+ * // => true
9484
+ *
9485
+ * _.inRange(4, 2);
9486
+ * // => false
9487
+ *
9488
+ * _.inRange(2, 2);
9489
+ * // => false
9490
+ *
9491
+ * _.inRange(1.2, 2);
9492
+ * // => true
9493
+ *
9494
+ * _.inRange(5.2, 4);
9495
+ * // => false
9496
+ */
9497
+ function inRange(value, start, end) {
9498
+ start = +start || 0;
9499
+ if (typeof end === 'undefined') {
9500
+ end = start;
9501
+ start = 0;
9502
+ } else {
9503
+ end = +end || 0;
9504
+ }
9505
+ return value >= start && value < end;
9506
+ }
9507
+
9358
9508
  /**
9359
9509
  * Produces a random number between `min` and `max` (inclusive). If only one
9360
9510
  * argument is provided a number between `0` and the given number is returned.
@@ -9574,7 +9724,7 @@
9574
9724
  }
9575
9725
 
9576
9726
  /**
9577
- * Converts `string` to kebab case (a.k.a. spinal case).
9727
+ * Converts `string` to kebab case.
9578
9728
  * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for
9579
9729
  * more details.
9580
9730
  *
@@ -10173,13 +10323,21 @@
10173
10323
  * _.trunc('hi-diddly-ho there, neighborino', 24);
10174
10324
  * // => 'hi-diddly-ho there, n...'
10175
10325
  *
10176
- * _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' });
10326
+ * _.trunc('hi-diddly-ho there, neighborino', {
10327
+ * 'length': 24,
10328
+ * 'separator': ' '
10329
+ * });
10177
10330
  * // => 'hi-diddly-ho there,...'
10178
10331
  *
10179
- * _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ });
10332
+ * _.trunc('hi-diddly-ho there, neighborino', {
10333
+ * 'length': 24,
10334
+ * 'separator': /,? +/
10335
+ * });
10180
10336
  * //=> 'hi-diddly-ho there...'
10181
10337
  *
10182
- * _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' [...]' });
10338
+ * _.trunc('hi-diddly-ho there, neighborino', {
10339
+ * 'omission': ' [...]'
10340
+ * });
10183
10341
  * // => 'hi-diddly-ho there, neig [...]'
10184
10342
  */
10185
10343
  function trunc(string, options, guard) {
@@ -10307,9 +10465,16 @@
10307
10465
  * elements = [];
10308
10466
  * }
10309
10467
  */
10310
- function attempt(func) {
10468
+ function attempt() {
10469
+ var length = arguments.length,
10470
+ func = arguments[0];
10471
+
10311
10472
  try {
10312
- return func.apply(undefined, baseSlice(arguments, 1));
10473
+ var args = Array(length ? length - 1 : 0);
10474
+ while (--length > 0) {
10475
+ args[length - 1] = arguments[length];
10476
+ }
10477
+ return func.apply(undefined, args);
10313
10478
  } catch(e) {
10314
10479
  return isError(e) ? e : new Error(e);
10315
10480
  }
@@ -10344,7 +10509,9 @@
10344
10509
  * return callback(func, thisArg);
10345
10510
  * }
10346
10511
  * return function(object) {
10347
- * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
10512
+ * return match[2] == 'gt'
10513
+ * ? object[match[1]] > match[3]
10514
+ * : object[match[1]] < match[3];
10348
10515
  * };
10349
10516
  * });
10350
10517
  *
@@ -10372,6 +10539,7 @@
10372
10539
  *
10373
10540
  * var object = { 'user': 'fred' };
10374
10541
  * var getter = _.constant(object);
10542
+ *
10375
10543
  * getter() === object;
10376
10544
  * // => true
10377
10545
  */
@@ -10392,6 +10560,7 @@
10392
10560
  * @example
10393
10561
  *
10394
10562
  * var object = { 'user': 'fred' };
10563
+ *
10395
10564
  * _.identity(object) === object;
10396
10565
  * // => true
10397
10566
  */
@@ -10445,14 +10614,12 @@
10445
10614
  * @example
10446
10615
  *
10447
10616
  * var users = [
10448
- * { 'user': 'barney', 'age': 36 },
10449
- * { 'user': 'fred', 'age': 40 },
10450
- * { 'user': 'pebbles', 'age': 1 }
10617
+ * { 'user': 'barney' },
10618
+ * { 'user': 'fred' },
10619
+ * { 'user': 'pebbles' }
10451
10620
  * ];
10452
10621
  *
10453
- * var matchFred = _.matchesProperty('user', 'fred');
10454
- *
10455
- * _.find(users, matchFred);
10622
+ * _.find(users, _.matchesProperty('user', 'fred'));
10456
10623
  * // => { 'user': 'fred', 'age': 40 }
10457
10624
  */
10458
10625
  function matchesProperty(key, value) {
@@ -10564,7 +10731,8 @@
10564
10731
  }
10565
10732
 
10566
10733
  /**
10567
- * A no-operation function.
10734
+ * A no-operation function which returns `undefined` regardless of the
10735
+ * arguments it receives.
10568
10736
  *
10569
10737
  * @static
10570
10738
  * @memberOf _
@@ -10572,6 +10740,7 @@
10572
10740
  * @example
10573
10741
  *
10574
10742
  * var object = { 'user': 'fred' };
10743
+ *
10575
10744
  * _.noop(object) === undefined;
10576
10745
  * // => true
10577
10746
  */
@@ -10617,11 +10786,11 @@
10617
10786
  * @returns {Function} Returns the new function.
10618
10787
  * @example
10619
10788
  *
10620
- * var object = { 'user': 'fred', 'age': 40, 'active': true };
10621
- * _.map(['active', 'user'], _.propertyOf(object));
10622
- * // => [true, 'fred']
10623
- *
10624
10789
  * var object = { 'a': 3, 'b': 1, 'c': 2 };
10790
+ *
10791
+ * _.map(['a', 'c'], _.propertyOf(object));
10792
+ * // => [3, 2]
10793
+ *
10625
10794
  * _.sortBy(['a', 'b', 'c'], _.propertyOf(object));
10626
10795
  * // => ['b', 'c', 'a']
10627
10796
  */
@@ -10633,8 +10802,9 @@
10633
10802
 
10634
10803
  /**
10635
10804
  * Creates an array of numbers (positive and/or negative) progressing from
10636
- * `start` up to, but not including, `end`. If `start` is less than `end` a
10637
- * zero-length range is created unless a negative `step` is specified.
10805
+ * `start` up to, but not including, `end`. If `end` is not specified it
10806
+ * defaults to `start` with `start` becoming `0`. If `start` is less than
10807
+ * `end` a zero-length range is created unless a negative `step` is specified.
10638
10808
  *
10639
10809
  * @static
10640
10810
  * @memberOf _
@@ -10706,10 +10876,14 @@
10706
10876
  * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false));
10707
10877
  * // => [3, 6, 4]
10708
10878
  *
10709
- * _.times(3, function(n) { mage.castSpell(n); });
10879
+ * _.times(3, function(n) {
10880
+ * mage.castSpell(n);
10881
+ * });
10710
10882
  * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively
10711
10883
  *
10712
- * _.times(3, function(n) { this.cast(n); }, mage);
10884
+ * _.times(3, function(n) {
10885
+ * this.cast(n);
10886
+ * }, mage);
10713
10887
  * // => also invokes `mage.castSpell(n)` three times
10714
10888
  */
10715
10889
  function times(n, iteratee, thisArg) {
@@ -10757,11 +10931,13 @@
10757
10931
 
10758
10932
  /*------------------------------------------------------------------------*/
10759
10933
 
10760
- // Ensure `new LodashWrapper` is an instance of `lodash`.
10761
- LodashWrapper.prototype = baseCreate(lodash.prototype);
10934
+ // Ensure wrappers are instances of `baseLodash`.
10935
+ lodash.prototype = baseLodash.prototype;
10936
+
10937
+ LodashWrapper.prototype = baseCreate(baseLodash.prototype);
10938
+ LodashWrapper.prototype.constructor = LodashWrapper;
10762
10939
 
10763
- // Ensure `new LazyWraper` is an instance of `LodashWrapper`
10764
- LazyWrapper.prototype = baseCreate(LodashWrapper.prototype);
10940
+ LazyWrapper.prototype = baseCreate(baseLodash.prototype);
10765
10941
  LazyWrapper.prototype.constructor = LazyWrapper;
10766
10942
 
10767
10943
  // Add functions to the `Map` cache.
@@ -10919,6 +11095,7 @@
10919
11095
  lodash.identity = identity;
10920
11096
  lodash.includes = includes;
10921
11097
  lodash.indexOf = indexOf;
11098
+ lodash.inRange = inRange;
10922
11099
  lodash.isArguments = isArguments;
10923
11100
  lodash.isArray = isArray;
10924
11101
  lodash.isBoolean = isBoolean;
@@ -11101,18 +11278,18 @@
11101
11278
  return this.filter(identity);
11102
11279
  };
11103
11280
 
11104
- LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) {
11281
+ LazyWrapper.prototype.dropWhile = function(predicate, thisArg) {
11105
11282
  var done;
11106
- iteratee = getCallback(iteratee, thisArg, 3);
11283
+ predicate = getCallback(predicate, thisArg, 3);
11107
11284
  return this.filter(function(value, index, array) {
11108
- return done || (done = !iteratee(value, index, array));
11285
+ return done || (done = !predicate(value, index, array));
11109
11286
  });
11110
11287
  };
11111
11288
 
11112
- LazyWrapper.prototype.reject = function(iteratee, thisArg) {
11113
- iteratee = getCallback(iteratee, thisArg, 3);
11289
+ LazyWrapper.prototype.reject = function(predicate, thisArg) {
11290
+ predicate = getCallback(predicate, thisArg, 3);
11114
11291
  return this.filter(function(value, index, array) {
11115
- return !iteratee(value, index, array);
11292
+ return !predicate(value, index, array);
11116
11293
  });
11117
11294
  };
11118
11295
 
@@ -11190,7 +11367,7 @@
11190
11367
  LazyWrapper.prototype.reverse = lazyReverse;
11191
11368
  LazyWrapper.prototype.value = lazyValue;
11192
11369
 
11193
- // Add chaining functions to the lodash wrapper.
11370
+ // Add chaining functions to the `lodash` wrapper.
11194
11371
  lodash.prototype.chain = wrapperChain;
11195
11372
  lodash.prototype.commit = wrapperCommit;
11196
11373
  lodash.prototype.plant = wrapperPlant;
@@ -11198,7 +11375,7 @@
11198
11375
  lodash.prototype.toString = wrapperToString;
11199
11376
  lodash.prototype.run = lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
11200
11377
 
11201
- // Add function aliases to the lodash wrapper.
11378
+ // Add function aliases to the `lodash` wrapper.
11202
11379
  lodash.prototype.collect = lodash.prototype.map;
11203
11380
  lodash.prototype.head = lodash.prototype.first;
11204
11381
  lodash.prototype.select = lodash.prototype.filter;