lodash._basecallback
Advanced tools
Comparing version 3.1.2 to 3.1.3
86
index.js
/** | ||
* lodash 3.1.2 (Custom Build) <https://lodash.com/> | ||
* lodash 3.1.3 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE> | ||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
@@ -13,8 +13,2 @@ * Available under MIT license <https://lodash.com/license> | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
@@ -33,5 +27,5 @@ * The base implementation of `_.callback` which supports specifying the | ||
if (type == 'function') { | ||
return (typeof thisArg != 'undefined') | ||
? bindCallback(func, thisArg, argCount) | ||
: func; | ||
return typeof thisArg == 'undefined' | ||
? func | ||
: bindCallback(func, thisArg, argCount); | ||
} | ||
@@ -51,3 +45,3 @@ if (func == null) { | ||
* The base implementation of `_.isMatch` without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -63,7 +57,4 @@ * @private | ||
function baseIsMatch(object, props, values, strictCompareFlags, customizer) { | ||
var length = props.length; | ||
if (object == null) { | ||
return !length; | ||
} | ||
var index = -1, | ||
length = props.length, | ||
noCustomizer = !customizer; | ||
@@ -74,3 +65,3 @@ | ||
? values[index] !== object[props[index]] | ||
: !hasOwnProperty.call(object, props[index]) | ||
: !(props[index] in object) | ||
) { | ||
@@ -82,9 +73,9 @@ return false; | ||
while (++index < length) { | ||
var key = props[index]; | ||
var key = props[index], | ||
objValue = object[key], | ||
srcValue = values[index]; | ||
if (noCustomizer && strictCompareFlags[index]) { | ||
var result = hasOwnProperty.call(object, key); | ||
var result = typeof objValue != 'undefined' || (key in object); | ||
} else { | ||
var objValue = object[key], | ||
srcValue = values[index]; | ||
result = customizer ? customizer(objValue, srcValue, key) : undefined; | ||
@@ -113,2 +104,5 @@ if (typeof result == 'undefined') { | ||
if (!length) { | ||
return constant(true); | ||
} | ||
if (length == 1) { | ||
@@ -120,3 +114,4 @@ var key = props[0], | ||
return function(object) { | ||
return object != null && object[key] === value && hasOwnProperty.call(object, key); | ||
return object != null && object[key] === value && | ||
(typeof value != 'undefined' || (key in toObject(object))); | ||
}; | ||
@@ -134,3 +129,3 @@ } | ||
return function(object) { | ||
return baseIsMatch(object, props, values, strictCompareFlags); | ||
return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); | ||
}; | ||
@@ -151,3 +146,4 @@ } | ||
return function(object) { | ||
return object != null && object[key] === value; | ||
return object != null && object[key] === value && | ||
(typeof value != 'undefined' || (key in toObject(object))); | ||
}; | ||
@@ -186,7 +182,16 @@ } | ||
/** | ||
* Checks if `value` is the language type of `Object`. | ||
* Converts `value` to an object if it is not one. | ||
* | ||
* @private | ||
* @param {*} value The value to process. | ||
* @returns {Object} Returns the object. | ||
*/ | ||
function toObject(value) { | ||
return isObject(value) ? value : Object(value); | ||
} | ||
/** | ||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. | ||
* | ||
* @static | ||
@@ -212,6 +217,28 @@ * @memberOf _ | ||
var type = typeof value; | ||
return type == 'function' || (value && type == 'object') || false; | ||
return type == 'function' || (!!value && type == 'object'); | ||
} | ||
/** | ||
* Creates a function that returns `value`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Utility | ||
* @param {*} value The value to return from the new function. | ||
* @returns {Function} Returns the new function. | ||
* @example | ||
* | ||
* var object = { 'user': 'fred' }; | ||
* var getter = _.constant(object); | ||
* | ||
* getter() === object; | ||
* // => true | ||
*/ | ||
function constant(value) { | ||
return function() { | ||
return value; | ||
}; | ||
} | ||
/** | ||
* This method returns the first argument provided to it. | ||
@@ -227,2 +254,3 @@ * | ||
* var object = { 'user': 'fred' }; | ||
* | ||
* _.identity(object) === object; | ||
@@ -229,0 +257,0 @@ * // => true |
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, | ||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, | ||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "lodash._basecallback", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "The modern build of lodash’s internal `baseCallback` as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash._basecallback v3.1.2 | ||
# lodash._basecallback v3.1.3 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseCallback` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash._basecallback) for more details. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash._basecallback) for more details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9600
234