lodash.slice
Advanced tools
Comparing version 4.0.6 to 4.1.0
57
index.js
@@ -9,3 +9,2 @@ /** | ||
*/ | ||
var baseSlice = require('lodash._baseslice'); | ||
@@ -41,2 +40,15 @@ /** Used as references for various `Number` constants. */ | ||
/** | ||
* The base implementation of `_.property` without support for deep paths. | ||
* | ||
* @private | ||
* @param {string} key The key of the property to get. | ||
* @returns {Function} Returns the new accessor function. | ||
*/ | ||
function baseProperty(key) { | ||
return function(object) { | ||
return object == null ? undefined : object[key]; | ||
}; | ||
} | ||
/** Used for built-in method references. */ | ||
@@ -53,12 +65,29 @@ var objectProto = Object.prototype; | ||
/** | ||
* The base implementation of `_.property` without support for deep paths. | ||
* The base implementation of `_.slice` without an iteratee call guard. | ||
* | ||
* @private | ||
* @param {string} key The key of the property to get. | ||
* @returns {Function} Returns the new accessor function. | ||
* @param {Array} array The array to slice. | ||
* @param {number} [start=0] The start position. | ||
* @param {number} [end=array.length] The end position. | ||
* @returns {Array} Returns the slice of `array`. | ||
*/ | ||
function baseProperty(key) { | ||
return function(object) { | ||
return object == null ? undefined : object[key]; | ||
}; | ||
function baseSlice(array, start, end) { | ||
var index = -1, | ||
length = array.length; | ||
if (start < 0) { | ||
start = -start > length ? 0 : (length + start); | ||
} | ||
end = end > length ? length : end; | ||
if (end < 0) { | ||
end += length; | ||
} | ||
length = start > end ? 0 : ((end - start) >>> 0); | ||
start >>>= 0; | ||
var result = Array(length); | ||
while (++index < length) { | ||
result[index] = array[index + start]; | ||
} | ||
return result; | ||
} | ||
@@ -164,4 +193,4 @@ | ||
* | ||
* var object = { 'user': 'fred' }; | ||
* var other = { 'user': 'fred' }; | ||
* var object = { 'a': 1 }; | ||
* var other = { 'a': 1 }; | ||
* | ||
@@ -224,4 +253,3 @@ * _.eq(object, object); | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if `value` is a function, else `false`. | ||
* @example | ||
@@ -341,4 +369,3 @@ * | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`. | ||
* @example | ||
@@ -395,3 +422,3 @@ * | ||
* | ||
* **Note:** This function is loosely based on | ||
* **Note:** This method is loosely based on | ||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). | ||
@@ -398,0 +425,0 @@ * |
{ | ||
"name": "lodash.slice", | ||
"version": "4.0.6", | ||
"version": "4.1.0", | ||
"description": "The lodash method `_.slice` exported as a module.", | ||
@@ -16,6 +16,3 @@ "homepage": "https://lodash.com/", | ||
"repository": "lodash/lodash", | ||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, | ||
"dependencies": { | ||
"lodash._baseslice": "~4.0.0" | ||
} | ||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.slice v4.0.6 | ||
# lodash.slice v4.1.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.slice` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#slice) or [package source](https://github.com/lodash/lodash/blob/4.0.6-npm-packages/lodash.slice) for more details. | ||
See the [documentation](https://lodash.com/docs#slice) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.slice) for more details. |
15139
0
460
- Removedlodash._baseslice@~4.0.0
- Removedlodash._baseslice@4.0.0(transitive)