mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Expose _.noop. [closes #380]
This commit is contained in:
46
lodash.js
46
lodash.js
@@ -390,15 +390,6 @@
|
||||
return typeof value.toString != 'function' && typeof (value + '') == 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* A no-operation function.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function noop() {
|
||||
// no operation performed
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases the given array back to the array pool.
|
||||
*
|
||||
@@ -1133,14 +1124,18 @@
|
||||
}
|
||||
// fallback for browsers without `Object.create`
|
||||
if (!nativeCreate) {
|
||||
baseCreate = function(prototype) {
|
||||
if (isObject(prototype)) {
|
||||
noop.prototype = prototype;
|
||||
var result = new noop;
|
||||
noop.prototype = null;
|
||||
}
|
||||
return result || {};
|
||||
};
|
||||
baseCreate = (function() {
|
||||
function Object() {}
|
||||
|
||||
return function(prototype) {
|
||||
if (isObject(prototype)) {
|
||||
Object.prototype = prototype;
|
||||
var result = new Object;
|
||||
Object.prototype = null;
|
||||
}
|
||||
return result || context.Object();
|
||||
};
|
||||
}());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6134,6 +6129,22 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A no-operation function.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utilities
|
||||
* @example
|
||||
*
|
||||
* var object = { 'name': 'fred' };
|
||||
* _.noop(object) === undefined;
|
||||
* // => true
|
||||
*/
|
||||
function noop() {
|
||||
// no operation performed
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the given value into an integer of the specified radix.
|
||||
* If `radix` is `undefined` or `0` a `radix` of `10` is used unless the
|
||||
@@ -6754,6 +6765,7 @@
|
||||
lodash.lastIndexOf = lastIndexOf;
|
||||
lodash.mixin = mixin;
|
||||
lodash.noConflict = noConflict;
|
||||
lodash.noop = noop;
|
||||
lodash.parseInt = parseInt;
|
||||
lodash.random = random;
|
||||
lodash.reduce = reduce;
|
||||
|
||||
Reference in New Issue
Block a user