mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Compare commits
2 Commits
3.7.2-npm-
...
3.7.4-npm-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52fcde9b85 | ||
|
|
2947fac514 |
@@ -1,4 +1,4 @@
|
|||||||
# lodash v3.7.2
|
# lodash v3.7.4
|
||||||
|
|
||||||
The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.
|
The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# lodash.set v3.7.2
|
# lodash.set v3.7.4
|
||||||
|
|
||||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.set` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.set` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
||||||
|
|
||||||
@@ -17,4 +17,4 @@ In Node.js/io.js:
|
|||||||
var set = require('lodash.set');
|
var set = require('lodash.set');
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [documentation](https://lodash.com/docs#set) or [package source](https://github.com/lodash/lodash/blob/3.7.2-npm-packages/lodash.set) for more details.
|
See the [documentation](https://lodash.com/docs#set) or [package source](https://github.com/lodash/lodash/blob/3.7.4-npm-packages/lodash.set) for more details.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* lodash 3.7.2 (Custom Build) <https://lodash.com/>
|
* lodash 3.7.4 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||||
@@ -13,8 +13,11 @@ var toPath = require('lodash._topath'),
|
|||||||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
|
||||||
reIsPlainProp = /^\w*$/;
|
reIsPlainProp = /^\w*$/;
|
||||||
|
|
||||||
|
/** Used to detect unsigned integer values. */
|
||||||
|
var reIsUint = /^\d+$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
|
||||||
* of an array-like value.
|
* of an array-like value.
|
||||||
*/
|
*/
|
||||||
var MAX_SAFE_INTEGER = 9007199254740991;
|
var MAX_SAFE_INTEGER = 9007199254740991;
|
||||||
@@ -28,7 +31,7 @@ var MAX_SAFE_INTEGER = 9007199254740991;
|
|||||||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
||||||
*/
|
*/
|
||||||
function isIndex(value, length) {
|
function isIndex(value, length) {
|
||||||
value = typeof value == 'number' ? value : parseFloat(value);
|
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
||||||
length = length == null ? MAX_SAFE_INTEGER : length;
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
||||||
return value > -1 && value % 1 == 0 && value < length;
|
return value > -1 && value % 1 == 0 && value < length;
|
||||||
}
|
}
|
||||||
@@ -93,7 +96,7 @@ function isObject(value) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the property value of `path` on `object`. If a portion of `path`
|
* Sets the property value of `path` on `object`. If a portion of `path`
|
||||||
* does not exist it is created.
|
* does not exist it's created.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -123,13 +126,13 @@ function set(object, path, value) {
|
|||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = path.length,
|
length = path.length,
|
||||||
endIndex = length - 1,
|
lastIndex = length - 1,
|
||||||
nested = object;
|
nested = object;
|
||||||
|
|
||||||
while (nested != null && ++index < length) {
|
while (nested != null && ++index < length) {
|
||||||
var key = path[index];
|
var key = path[index];
|
||||||
if (isObject(nested)) {
|
if (isObject(nested)) {
|
||||||
if (index == endIndex) {
|
if (index == lastIndex) {
|
||||||
nested[key] = value;
|
nested[key] = value;
|
||||||
} else if (nested[key] == null) {
|
} else if (nested[key] == null) {
|
||||||
nested[key] = isIndex(path[index + 1]) ? [] : {};
|
nested[key] = isIndex(path[index + 1]) ? [] : {};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash.set",
|
"name": "lodash.set",
|
||||||
"version": "3.7.2",
|
"version": "3.7.4",
|
||||||
"description": "The modern build of lodash’s `_.set` as a module.",
|
"description": "The modern build of lodash’s `_.set` as a module.",
|
||||||
"homepage": "https://lodash.com/",
|
"homepage": "https://lodash.com/",
|
||||||
"icon": "https://lodash.com/icon.svg",
|
"icon": "https://lodash.com/icon.svg",
|
||||||
|
|||||||
Reference in New Issue
Block a user