lodash.transform
Advanced tools
Comparing version
75
index.js
/** | ||
* lodash 4.1.0 (Custom Build) <https://lodash.com/> | ||
* lodash 4.1.1 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
@@ -16,4 +16,4 @@ * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
keys = require('lodash.keys'), | ||
root = require('lodash._root'), | ||
toPairs = require('lodash.topairs'); | ||
toPairs = require('lodash.topairs'), | ||
toString = require('lodash.tostring'); | ||
@@ -25,4 +25,3 @@ /** Used to compose bitmasks for comparison styles. */ | ||
/** Used as references for various `Number` constants. */ | ||
var INFINITY = 1 / 0, | ||
MAX_SAFE_INTEGER = 9007199254740991; | ||
var MAX_SAFE_INTEGER = 9007199254740991; | ||
@@ -43,3 +42,2 @@ /** `Object#toString` result references. */ | ||
stringTag = '[object String]', | ||
symbolTag = '[object Symbol]', | ||
weakMapTag = '[object WeakMap]'; | ||
@@ -90,9 +88,2 @@ | ||
/** Built-in value references. */ | ||
var Symbol = root.Symbol; | ||
/** Used to convert symbols to primitives and strings. */ | ||
var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
symbolToString = Symbol ? symbolProto.toString : undefined; | ||
/** | ||
@@ -448,23 +439,2 @@ * The base implementation of `_.create` without support for assigning | ||
/** | ||
* Checks if `value` is classified as a `Symbol` primitive or object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
* @example | ||
* | ||
* _.isSymbol(Symbol.iterator); | ||
* // => true | ||
* | ||
* _.isSymbol('abc'); | ||
* // => false | ||
*/ | ||
function isSymbol(value) { | ||
return typeof value == 'symbol' || | ||
(isObjectLike(value) && objectToString.call(value) == symbolTag); | ||
} | ||
/** | ||
* Checks if `value` is classified as a typed array. | ||
@@ -490,37 +460,2 @@ * | ||
/** | ||
* Converts `value` to a string if it's not one. An empty string is returned | ||
* for `null` and `undefined` values. The sign of `-0` is preserved. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to process. | ||
* @returns {string} Returns the string. | ||
* @example | ||
* | ||
* _.toString(null); | ||
* // => '' | ||
* | ||
* _.toString(-0); | ||
* // => '-0' | ||
* | ||
* _.toString([1, 2, 3]); | ||
* // => '1,2,3' | ||
*/ | ||
function toString(value) { | ||
// Exit early for strings to avoid a performance hit in some environments. | ||
if (typeof value == 'string') { | ||
return value; | ||
} | ||
if (value == null) { | ||
return ''; | ||
} | ||
if (isSymbol(value)) { | ||
return Symbol ? symbolToString.call(value) : ''; | ||
} | ||
var result = (value + ''); | ||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | ||
} | ||
/** | ||
* An alternative to `_.reduce`; this method transforms `object` to a new | ||
@@ -576,3 +511,3 @@ * `accumulator` object which is the result of running each of its own enumerable | ||
/** | ||
* This method returns the first argument provided to it. | ||
* This method returns the first argument given to it. | ||
* | ||
@@ -579,0 +514,0 @@ * @static |
{ | ||
"name": "lodash.transform", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "The lodash method `_.transform` exported as a module.", | ||
@@ -22,8 +22,8 @@ "homepage": "https://lodash.com/", | ||
"lodash._baseismatch": "^4.0.0", | ||
"lodash._root": "^3.0.0", | ||
"lodash.get": "^4.0.0", | ||
"lodash.hasin": "^4.0.0", | ||
"lodash.keys": "^4.0.0", | ||
"lodash.topairs": "^4.0.0" | ||
"lodash.topairs": "^4.0.0", | ||
"lodash.tostring": "^4.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.transform v4.1.0 | ||
# lodash.transform v4.1.1 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.transform` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#transform) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.transform) for more details. | ||
See the [documentation](https://lodash.com/docs#transform) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.transform) for more details. |
Sorry, the diff of this file is not supported yet
17908
-8%511
-10.66%+ Added
+ Added
- Removed