mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Rename mock to stub.
This commit is contained in:
216
lodash.js
216
lodash.js
@@ -1232,10 +1232,10 @@
|
||||
* lodash.isFunction(lodash.bar);
|
||||
* // => true
|
||||
*
|
||||
* // Use `context` to mock `Date#getTime` use in `_.now`.
|
||||
* var mock = _.runInContext({
|
||||
* // Use `context` to stub `Date#getTime` use in `_.now`.
|
||||
* var stubbed = _.runInContext({
|
||||
* 'Date': function() {
|
||||
* return { 'getTime': getTimeMock };
|
||||
* return { 'getTime': stubGetTime };
|
||||
* }
|
||||
* });
|
||||
*
|
||||
@@ -1425,16 +1425,16 @@
|
||||
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
||||
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
|
||||
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
|
||||
* `min`, `minBy`, `mockArray`, `mockFalse`, `mockObject`, `mockString`,
|
||||
* `mockTrue`, multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`,
|
||||
* `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`,
|
||||
* `result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`,
|
||||
* `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`,
|
||||
* `startCase`, `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`,
|
||||
* `toFinite`, `toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`,
|
||||
* `toSafeInteger`, `toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`,
|
||||
* `truncate`, `unescape`, `uniqueId`, `upperCase`, `upperFirst`, `value`,
|
||||
* and `words`
|
||||
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
|
||||
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
|
||||
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
|
||||
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
|
||||
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
|
||||
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
|
||||
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
|
||||
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
|
||||
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
|
||||
* `upperFirst`, `value`, and `words`
|
||||
*
|
||||
* @name _
|
||||
* @constructor
|
||||
@@ -5422,7 +5422,7 @@
|
||||
|
||||
// Fallback for IE < 11.
|
||||
if (!getOwnPropertySymbols) {
|
||||
getSymbols = mockArray;
|
||||
getSymbols = stubArray;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14959,95 +14959,6 @@
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns a new empty array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {Array} Returns the new empty array.
|
||||
* @example
|
||||
*
|
||||
* var arrays = _.times(2, _.mockArray);
|
||||
*
|
||||
* console.log(arrays);
|
||||
* // => [[], []]
|
||||
*
|
||||
* console.log(arrays[0] === arrays[1]);
|
||||
* // => false
|
||||
*/
|
||||
function mockArray() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {boolean} Returns `false`.
|
||||
* @example
|
||||
*
|
||||
* _.times(2 _.mockFalse);
|
||||
* // => [false, false]
|
||||
*/
|
||||
var mockFalse = constant(false);
|
||||
|
||||
/**
|
||||
* A method that returns a new empty object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {Object} Returns the new empty object.
|
||||
* @example
|
||||
*
|
||||
* var objects = _.times(2, _.mockObject);
|
||||
*
|
||||
* console.log(objects);
|
||||
* // => [{}, {}]
|
||||
*
|
||||
* console.log(objects[0] === objects[1]);
|
||||
* // => false
|
||||
*/
|
||||
function mockObject() {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns an empty string.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {string} Returns the empty string.
|
||||
* @example
|
||||
*
|
||||
* _.times(2, _.mockString);
|
||||
* // => ['', '']
|
||||
*/
|
||||
var mockString = constant('');
|
||||
|
||||
/**
|
||||
* A method that returns `true`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {boolean} Returns `true`.
|
||||
* @example
|
||||
*
|
||||
* _.times(2, _.mockTrue);
|
||||
* // => [true, true]
|
||||
*/
|
||||
var mockTrue = constant(true);
|
||||
|
||||
/**
|
||||
* Reverts the `_` variable to its previous value and returns a reference to
|
||||
* the `lodash` function.
|
||||
@@ -15317,6 +15228,95 @@
|
||||
*/
|
||||
var rangeRight = createRange(true);
|
||||
|
||||
/**
|
||||
* A method that returns a new empty array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {Array} Returns the new empty array.
|
||||
* @example
|
||||
*
|
||||
* var arrays = _.times(2, _.stubArray);
|
||||
*
|
||||
* console.log(arrays);
|
||||
* // => [[], []]
|
||||
*
|
||||
* console.log(arrays[0] === arrays[1]);
|
||||
* // => false
|
||||
*/
|
||||
function stubArray() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {boolean} Returns `false`.
|
||||
* @example
|
||||
*
|
||||
* _.times(2 _.stubFalse);
|
||||
* // => [false, false]
|
||||
*/
|
||||
var stubFalse = constant(false);
|
||||
|
||||
/**
|
||||
* A method that returns a new empty object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {Object} Returns the new empty object.
|
||||
* @example
|
||||
*
|
||||
* var objects = _.times(2, _.stubObject);
|
||||
*
|
||||
* console.log(objects);
|
||||
* // => [{}, {}]
|
||||
*
|
||||
* console.log(objects[0] === objects[1]);
|
||||
* // => false
|
||||
*/
|
||||
function stubObject() {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns an empty string.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {string} Returns the empty string.
|
||||
* @example
|
||||
*
|
||||
* _.times(2, _.stubString);
|
||||
* // => ['', '']
|
||||
*/
|
||||
var stubString = constant('');
|
||||
|
||||
/**
|
||||
* A method that returns `true`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {boolean} Returns `true`.
|
||||
* @example
|
||||
*
|
||||
* _.times(2, _.stubTrue);
|
||||
* // => [true, true]
|
||||
*/
|
||||
var stubTrue = constant(true);
|
||||
|
||||
/**
|
||||
* Invokes the iteratee `n` times, returning an array of the results of
|
||||
* each invocation. The iteratee is invoked with one argument; (index).
|
||||
@@ -16008,11 +16008,11 @@
|
||||
lodash.meanBy = meanBy;
|
||||
lodash.min = min;
|
||||
lodash.minBy = minBy;
|
||||
lodash.mockArray = mockArray;
|
||||
lodash.mockFalse = mockFalse;
|
||||
lodash.mockObject = mockObject;
|
||||
lodash.mockTrue = mockTrue;
|
||||
lodash.mockString = mockString;
|
||||
lodash.stubArray = stubArray;
|
||||
lodash.stubFalse = stubFalse;
|
||||
lodash.stubObject = stubObject;
|
||||
lodash.stubString = stubString;
|
||||
lodash.stubTrue = stubTrue;
|
||||
lodash.multiply = multiply;
|
||||
lodash.nth = nth;
|
||||
lodash.noConflict = noConflict;
|
||||
|
||||
480
test/test.js
480
test/test.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user