lodash._basematches
Advanced tools
+30
-50
| /** | ||
| * lodash 3.1.5 (Custom Build) <https://lodash.com/> | ||
| * lodash 3.2.0 (Custom Build) <https://lodash.com/> | ||
| * Build: `lodash modern modularize exports="npm" -o ./` | ||
@@ -10,3 +10,3 @@ * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
| var baseIsMatch = require('lodash._baseismatch'), | ||
| keys = require('lodash.keys'); | ||
| pairs = require('lodash.pairs'); | ||
@@ -21,32 +21,34 @@ /** | ||
| function baseMatches(source) { | ||
| var props = keys(source), | ||
| length = props.length; | ||
| var matchData = getMatchData(source); | ||
| if (matchData.length == 1 && matchData[0][2]) { | ||
| var key = matchData[0][0], | ||
| value = matchData[0][1]; | ||
| if (!length) { | ||
| return constant(true); | ||
| return function(object) { | ||
| if (object == null) { | ||
| return false; | ||
| } | ||
| return object[key] === value && (value !== undefined || (key in toObject(object))); | ||
| }; | ||
| } | ||
| if (length == 1) { | ||
| var key = props[0], | ||
| value = source[key]; | ||
| return function(object) { | ||
| return baseIsMatch(object, matchData); | ||
| }; | ||
| } | ||
| if (isStrictComparable(value)) { | ||
| return function(object) { | ||
| if (object == null) { | ||
| return false; | ||
| } | ||
| return object[key] === value && (value !== undefined || (key in toObject(object))); | ||
| }; | ||
| } | ||
| } | ||
| var values = Array(length), | ||
| strictCompareFlags = Array(length); | ||
| /** | ||
| * Gets the propery names, values, and compare flags of `object`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @returns {Array} Returns the match data of `object`. | ||
| */ | ||
| function getMatchData(object) { | ||
| var result = pairs(object), | ||
| length = result.length; | ||
| while (length--) { | ||
| value = source[props[length]]; | ||
| values[length] = value; | ||
| strictCompareFlags[length] = isStrictComparable(value); | ||
| result[length][2] = isStrictComparable(result[length][1]); | ||
| } | ||
| return function(object) { | ||
| return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); | ||
| }; | ||
| return result; | ||
| } | ||
@@ -67,3 +69,3 @@ | ||
| /** | ||
| * Converts `value` to an object if it is not one. | ||
| * Converts `value` to an object if it's not one. | ||
| * | ||
@@ -102,27 +104,5 @@ * @private | ||
| var type = typeof value; | ||
| return type == 'function' || (!!value && type == 'object'); | ||
| return !!value && (type == 'object' || type == 'function'); | ||
| } | ||
| /** | ||
| * 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; | ||
| }; | ||
| } | ||
| module.exports = baseMatches; |
+2
-2
| { | ||
| "name": "lodash._basematches", | ||
| "version": "3.1.5", | ||
| "version": "3.2.0", | ||
| "description": "The modern build of lodash’s internal `baseMatches` as a module.", | ||
@@ -20,4 +20,4 @@ "homepage": "https://lodash.com/", | ||
| "lodash._baseismatch": "^3.0.0", | ||
| "lodash.keys": "^3.0.0" | ||
| "lodash.pairs": "^3.0.0" | ||
| } | ||
| } |
+2
-2
@@ -1,2 +0,2 @@ | ||
| # lodash._basematches v3.1.5 | ||
| # lodash._basematches v3.2.0 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseMatches` 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.5-npm-packages/lodash._basematches) for more details. | ||
| See the [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash._basematches) for more details. |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
5588
-6.3%96
-16.52%3
50%+ Added
+ Added
- Removed