mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Bump to v4.2.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# lodash.truncate v4.1.2
|
||||
# lodash.truncate v4.2.0
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.truncate` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
@@ -15,4 +15,4 @@ In Node.js:
|
||||
var truncate = require('lodash.truncate');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#truncate) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.truncate) for more details.
|
||||
See the [documentation](https://lodash.com/docs#truncate) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.truncate) for more details.
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
/**
|
||||
* lodash 4.1.2 (Custom Build) <https://lodash.com/>
|
||||
* lodash 4.2.0 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
||||
var toString = require('lodash.tostring');
|
||||
var baseSlice = require('lodash._baseslice'),
|
||||
toString = require('lodash.tostring');
|
||||
|
||||
/** Used as default options for `_.truncate`. */
|
||||
var DEFAULT_TRUNC_LENGTH = 30,
|
||||
@@ -109,6 +110,21 @@ var objectProto = Object.prototype;
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
/**
|
||||
* Casts `array` to a slice if it's needed.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {number} start The start position.
|
||||
* @param {number} [end=array.length] The end position.
|
||||
* @returns {Array} Returns the cast slice.
|
||||
*/
|
||||
function castSlice(array, start, end) {
|
||||
var length = array.length;
|
||||
end = end === undefined ? length : end;
|
||||
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Function` object.
|
||||
*
|
||||
@@ -382,7 +398,7 @@ function truncate(string, options) {
|
||||
return omission;
|
||||
}
|
||||
var result = strSymbols
|
||||
? strSymbols.slice(0, end).join('')
|
||||
? castSlice(strSymbols, 0, end).join('')
|
||||
: string.slice(0, end);
|
||||
|
||||
if (separator === undefined) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash.truncate",
|
||||
"version": "4.1.2",
|
||||
"version": "4.2.0",
|
||||
"description": "The lodash method `_.truncate` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
@@ -15,6 +15,7 @@
|
||||
"repository": "lodash/lodash",
|
||||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
|
||||
"dependencies": {
|
||||
"lodash._baseslice": "~4.0.0",
|
||||
"lodash.tostring": "^4.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user