mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Adjust "provided"/"given" use. [ci skip]
This commit is contained in:
40
lodash.js
40
lodash.js
@@ -2341,7 +2341,7 @@
|
|||||||
* @private
|
* @private
|
||||||
* @param {Function} func The function to delay.
|
* @param {Function} func The function to delay.
|
||||||
* @param {number} wait The number of milliseconds to delay invocation.
|
* @param {number} wait The number of milliseconds to delay invocation.
|
||||||
* @param {Object} args The arguments provide to `func`.
|
* @param {Object} args The arguments to provide to `func`.
|
||||||
* @returns {number} Returns the timer id.
|
* @returns {number} Returns the timer id.
|
||||||
*/
|
*/
|
||||||
function baseDelay(func, wait, args) {
|
function baseDelay(func, wait, args) {
|
||||||
@@ -2586,7 +2586,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.functions` which creates an array of
|
* The base implementation of `_.functions` which creates an array of
|
||||||
* `object` function property names filtered from those provided.
|
* `object` function property names filtered from `props`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to inspect.
|
* @param {Object} object The object to inspect.
|
||||||
@@ -5051,7 +5051,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the provided arguments are from an iteratee call.
|
* Checks if the given arguments are from an iteratee call.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {*} value The potential iteratee value argument.
|
* @param {*} value The potential iteratee value argument.
|
||||||
@@ -5459,7 +5459,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of unique `array` values not included in the other
|
* Creates an array of unique `array` values not included in the other
|
||||||
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
* given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||||
* for equality comparisons.
|
* for equality comparisons.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -5939,8 +5939,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of unique values that are included in all of the provided
|
* Creates an array of unique values that are included in all given arrays
|
||||||
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||||
* for equality comparisons.
|
* for equality comparisons.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -6105,7 +6105,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all provided values from `array` using
|
* Removes all given values from `array` using
|
||||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||||
* for equality comparisons.
|
* for equality comparisons.
|
||||||
*
|
*
|
||||||
@@ -6662,8 +6662,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of unique values, in order, from all of the provided arrays
|
* Creates an array of unique values, in order, from all given arrays using
|
||||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||||
* for equality comparisons.
|
* for equality comparisons.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -6874,7 +6874,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array excluding all provided values using
|
* Creates an array excluding all given values using
|
||||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||||
* for equality comparisons.
|
* for equality comparisons.
|
||||||
*
|
*
|
||||||
@@ -6897,7 +6897,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
||||||
* of the provided arrays.
|
* of the given arrays.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -7923,7 +7923,7 @@
|
|||||||
* Reduces `collection` to a value which is the accumulated result of running
|
* Reduces `collection` to a value which is the accumulated result of running
|
||||||
* each element in `collection` through `iteratee`, where each successive
|
* each element in `collection` through `iteratee`, where each successive
|
||||||
* invocation is supplied the return value of the previous. If `accumulator`
|
* invocation is supplied the return value of the previous. If `accumulator`
|
||||||
* is not provided the first element of `collection` is used as the initial
|
* is not given the first element of `collection` is used as the initial
|
||||||
* value. The iteratee is invoked with four arguments:
|
* value. The iteratee is invoked with four arguments:
|
||||||
* (accumulator, value, index|key, collection).
|
* (accumulator, value, index|key, collection).
|
||||||
*
|
*
|
||||||
@@ -10785,7 +10785,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an object that inherits from the `prototype` object. If a `properties`
|
* Creates an object that inherits from the `prototype` object. If a `properties`
|
||||||
* object is provided its own enumerable properties are assigned to the created object.
|
* object is given its own enumerable properties are assigned to the created object.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -12551,7 +12551,7 @@
|
|||||||
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
||||||
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
|
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
|
||||||
* properties may be accessed as free variables in the template. If a setting
|
* properties may be accessed as free variables in the template. If a setting
|
||||||
* object is provided it takes precedence over `_.templateSettings` values.
|
* object is given it takes precedence over `_.templateSettings` values.
|
||||||
*
|
*
|
||||||
* **Note:** In the development build `_.template` utilizes
|
* **Note:** In the development build `_.template` utilizes
|
||||||
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
||||||
@@ -13229,9 +13229,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that returns the result of invoking the provided
|
* Creates a function that returns the result of invoking the given functions
|
||||||
* functions with the `this` binding of the created function, where each
|
* with the `this` binding of the created function, where each successive
|
||||||
* successive invocation is supplied the return value of the previous.
|
* invocation is supplied the return value of the previous.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -13252,7 +13252,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.flow` except that it creates a function that
|
* This method is like `_.flow` except that it creates a function that
|
||||||
* invokes the provided functions from right to left.
|
* invokes the given functions from right to left.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -13272,7 +13272,7 @@
|
|||||||
var flowRight = createFlow(true);
|
var flowRight = createFlow(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the first argument provided to it.
|
* This method returns the first argument given to it.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -13824,7 +13824,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a unique ID. If `prefix` is provided the ID is appended to it.
|
* Generates a unique ID. If `prefix` is given the ID is appended to it.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
|
|||||||
50
test/test.js
50
test/test.js
@@ -948,7 +948,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should return provided `lodash` instances', function(assert) {
|
QUnit.test('should return the given `lodash` instances', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
@@ -1092,7 +1092,7 @@
|
|||||||
assert.deepEqual(capped('a', 'b', 'c', 'd'), ['a', 'b']);
|
assert.deepEqual(capped('a', 'b', 'c', 'd'), ['a', 'b']);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should use `func.length` if `n` is not provided', function(assert) {
|
QUnit.test('should use `func.length` if `n` is not given', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var capped = _.ary(fn);
|
var capped = _.ary(fn);
|
||||||
@@ -1125,7 +1125,7 @@
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should work when provided less than the capped number of arguments', function(assert) {
|
QUnit.test('should work when given less than the capped number of arguments', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var capped = _.ary(fn, 3);
|
var capped = _.ary(fn, 3);
|
||||||
@@ -1334,7 +1334,7 @@
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should return an empty array when no keys are provided', function(assert) {
|
QUnit.test('should return an empty array when no keys are given', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
assert.deepEqual(_.at(array), []);
|
assert.deepEqual(_.at(array), []);
|
||||||
@@ -1348,7 +1348,7 @@
|
|||||||
assert.deepEqual(actual, ['d', 'a', 'c']);
|
assert.deepEqual(actual, ['d', 'a', 'c']);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should work with a falsey `object` argument when keys are provided', function(assert) {
|
QUnit.test('should work with a falsey `object` argument when keys are given', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var expected = lodashStable.map(falsey, lodashStable.constant(Array(4)));
|
var expected = lodashStable.map(falsey, lodashStable.constant(Array(4)));
|
||||||
@@ -3433,7 +3433,7 @@
|
|||||||
return slice.call(arguments);
|
return slice.call(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.test('should curry based on the number of arguments provided', function(assert) {
|
QUnit.test('should curry based on the number of arguments given', function(assert) {
|
||||||
assert.expect(3);
|
assert.expect(3);
|
||||||
|
|
||||||
var curried = _.curry(fn),
|
var curried = _.curry(fn),
|
||||||
@@ -3565,7 +3565,7 @@
|
|||||||
return slice.call(arguments);
|
return slice.call(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.test('should curry based on the number of arguments provided', function(assert) {
|
QUnit.test('should curry based on the number of arguments given', function(assert) {
|
||||||
assert.expect(3);
|
assert.expect(3);
|
||||||
|
|
||||||
var curried = _.curryRight(fn),
|
var curried = _.curryRight(fn),
|
||||||
@@ -5037,7 +5037,7 @@
|
|||||||
assert.deepEqual(_.fill(array, 'a'), ['a', 'a', 'a']);
|
assert.deepEqual(_.fill(array, 'a'), ['a', 'a', 'a']);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should use `undefined` for `value` if not provided', function(assert) {
|
QUnit.test('should use `undefined` for `value` if not given', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var array = [1, 2, 3],
|
var array = [1, 2, 3],
|
||||||
@@ -5666,7 +5666,7 @@
|
|||||||
assert.notStrictEqual(func(noop), noop);
|
assert.notStrictEqual(func(noop), noop);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should return an identity function when no arguments are provided', function(assert) {
|
QUnit.test('`_.' + methodName + '` should return an identity function when no arguments are given', function(assert) {
|
||||||
assert.expect(3);
|
assert.expect(3);
|
||||||
|
|
||||||
var combined = func();
|
var combined = func();
|
||||||
@@ -6968,7 +6968,7 @@
|
|||||||
QUnit.module('lodash.identity');
|
QUnit.module('lodash.identity');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
QUnit.test('should return the first argument provided', function(assert) {
|
QUnit.test('should return the first argument given', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var object = { 'name': 'fred' };
|
var object = { 'name': 'fred' };
|
||||||
@@ -13377,7 +13377,7 @@
|
|||||||
QUnit.module('lodash.memoize');
|
QUnit.module('lodash.memoize');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
QUnit.test('should memoize results based on the first argument provided', function(assert) {
|
QUnit.test('should memoize results based on the first argument given', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var memoized = _.memoize(function(a, b, c) {
|
var memoized = _.memoize(function(a, b, c) {
|
||||||
@@ -14587,7 +14587,7 @@
|
|||||||
assert.expect(8);
|
assert.expect(8);
|
||||||
|
|
||||||
function message(func, chain) {
|
function message(func, chain) {
|
||||||
return (func === _ ? 'lodash' : 'provided') + ' function should ' + (chain ? '' : 'not ') + 'chain';
|
return (func === _ ? 'lodash' : 'given') + ' function should ' + (chain ? '' : 'not ') + 'chain';
|
||||||
}
|
}
|
||||||
|
|
||||||
lodashStable.each([_, Wrapper], function(func) {
|
lodashStable.each([_, Wrapper], function(func) {
|
||||||
@@ -14620,7 +14620,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should not extend lodash when an `object` is provided with an empty `options` object', function(assert) {
|
QUnit.test('should not extend lodash when an `object` is given with an empty `options` object', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
_.mixin({ 'a': noop }, {});
|
_.mixin({ 'a': noop }, {});
|
||||||
@@ -14785,7 +14785,7 @@
|
|||||||
assert.deepEqual(over(5, 10, 18), [10, 100, 18]);
|
assert.deepEqual(over(5, 10, 18), [10, 100, 18]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should not transform any arguments if no transforms are provided', function(assert) {
|
QUnit.test('should not transform any arguments if no transforms are given', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var over = _.overArgs(fn);
|
var over = _.overArgs(fn);
|
||||||
@@ -16521,7 +16521,7 @@
|
|||||||
assert.deepEqual(array, ['b']);
|
assert.deepEqual(array, ['b']);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should return an empty array when no indexes are provided', function(assert) {
|
QUnit.test('should return an empty array when no indexes are given', function(assert) {
|
||||||
assert.expect(4);
|
assert.expect(4);
|
||||||
|
|
||||||
var array = ['a', 'b', 'c'],
|
var array = ['a', 'b', 'c'],
|
||||||
@@ -16576,7 +16576,7 @@
|
|||||||
assert.deepEqual(actual, [undefined]);
|
assert.deepEqual(actual, [undefined]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should work with a falsey `array` argument when keys are provided', function(assert) {
|
QUnit.test('should work with a falsey `array` argument when keys are given', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var values = falsey.slice(),
|
var values = falsey.slice(),
|
||||||
@@ -16599,7 +16599,7 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var array = Array(1000);
|
var array = Array(1000);
|
||||||
|
|
||||||
QUnit.test('should return `0` or `1` when arguments are not provided', function(assert) {
|
QUnit.test('should return `0` or `1` when no arguments are given', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var actual = lodashStable.map(array, function() {
|
var actual = lodashStable.map(array, function() {
|
||||||
@@ -16721,14 +16721,14 @@
|
|||||||
return isRange ? range : range.reverse();
|
return isRange ? range : range.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should infer the sign of `step` when provided only an `end` argument', function(assert) {
|
QUnit.test('`_.' + methodName + '` should infer the sign of `step` when only `end` is given', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
assert.deepEqual(func(4), resolve([0, 1, 2, 3]));
|
assert.deepEqual(func(4), resolve([0, 1, 2, 3]));
|
||||||
assert.deepEqual(func(-4), resolve([0, -1, -2, -3]));
|
assert.deepEqual(func(-4), resolve([0, -1, -2, -3]));
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should infer the sign of `step` when provided only a `start` and `end` argument', function(assert) {
|
QUnit.test('`_.' + methodName + '` should infer the sign of `step` when only `start` and `end` are given', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
assert.deepEqual(func(1, 5), resolve([1, 2, 3, 4]));
|
assert.deepEqual(func(1, 5), resolve([1, 2, 3, 4]));
|
||||||
@@ -16850,7 +16850,7 @@
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should not rearrange arguments when no indexes are provided', function(assert) {
|
QUnit.test('should not rearrange arguments when no indexes are given', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var rearged = _.rearg(fn);
|
var rearged = _.rearg(fn);
|
||||||
@@ -17070,7 +17070,7 @@
|
|||||||
assert.strictEqual(actual, undefined);
|
assert.strictEqual(actual, undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should return `undefined` for empty collections when no `accumulator` is provided (test in IE > 9 and modern browsers)', function(assert) {
|
QUnit.test('`_.' + methodName + '` should return `undefined` for empty collections when no `accumulator` is given (test in IE > 9 and modern browsers)', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var array = [],
|
var array = [],
|
||||||
@@ -20336,7 +20336,7 @@
|
|||||||
assert.deepEqual(options, {});
|
assert.deepEqual(options, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should not modify `_.templateSettings` when `options` are provided', function(assert) {
|
QUnit.test('should not modify `_.templateSettings` when `options` are given', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
var data = { 'a': 1 };
|
var data = { 'a': 1 };
|
||||||
@@ -21770,7 +21770,7 @@
|
|||||||
Foo.prototype.constructor = Foo;
|
Foo.prototype.constructor = Foo;
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should create an empty object when provided a falsey `object` argument', function(assert) {
|
QUnit.test('should create an empty object when given a falsey `object` argument', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var expected = lodashStable.map(falsey, alwaysEmptyObject);
|
var expected = lodashStable.map(falsey, alwaysEmptyObject);
|
||||||
@@ -22899,7 +22899,7 @@
|
|||||||
assert.deepEqual(actual, [1]);
|
assert.deepEqual(actual, [1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should return a new array when a single array is provided', function(assert) {
|
QUnit.test('`_.' + methodName + '` should return a new array when a single array is given', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var array = [1];
|
var array = [1];
|
||||||
@@ -24052,7 +24052,7 @@
|
|||||||
assert.ok(lodashStable.isArray(actual), '_.' + methodName + ' returns an array');
|
assert.ok(lodashStable.isArray(actual), '_.' + methodName + ' returns an array');
|
||||||
|
|
||||||
var isPull = methodName == 'pull' || methodName == 'pullAll';
|
var isPull = methodName == 'pull' || methodName == 'pullAll';
|
||||||
assert.strictEqual(actual === array, isPull, '_.' + methodName + ' should ' + (isPull ? '' : 'not ') + 'return the provided array');
|
assert.strictEqual(actual === array, isPull, '_.' + methodName + ' should ' + (isPull ? '' : 'not ') + 'return the given array');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user