diff --git a/README.md b/README.md index ac3a12496..4236a1659 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v4.2.4 +# lodash v4.2.5 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash.template/README.md b/lodash.template/README.md index 4aba6ed16..03412ce49 100644 --- a/lodash.template/README.md +++ b/lodash.template/README.md @@ -1,4 +1,4 @@ -# lodash.template v4.2.4 +# lodash.template v4.2.5 The [lodash](https://lodash.com/) method `_.template` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var template = require('lodash.template'); ``` -See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/4.2.4-npm-packages/lodash.template) for more details. +See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/4.2.5-npm-packages/lodash.template) for more details. diff --git a/lodash.template/index.js b/lodash.template/index.js index 5a5a2d245..6a13bf50e 100644 --- a/lodash.template/index.js +++ b/lodash.template/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.2.4 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -119,20 +119,6 @@ function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -169,7 +155,7 @@ function assignInDefaults(objValue, srcValue, key, object) { * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { @@ -190,6 +176,21 @@ function baseProperty(key) { */ var getLength = baseProperty('length'); +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + /** * Checks if the given arguments are from an iteratee call. * @@ -486,12 +487,6 @@ function isObjectLike(value) { * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' * - * // Use custom template delimiters. - * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; - * var compiled = _.template('hello {{ user }}!'); - * compiled({ 'user': 'mustache' }); - * // => 'hello mustache!' - * * // Use backslashes to treat delimiters as plain text. * var compiled = _.template('<%= "\\<%- value %\\>" %>'); * compiled({ 'value': 'ignored' }); @@ -517,9 +512,15 @@ function isObjectLike(value) { * // return __p; * // } * + * // Use custom template delimiters. + * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; + * var compiled = _.template('hello {{ user }}!'); + * compiled({ 'user': 'mustache' }); + * // => 'hello mustache!' + * * // Use the `source` property to inline compiled templates for meaningful * // line numbers in error messages and stack traces. - * fs.writeFileSync(path.join(cwd, 'jst.js'), '\ + * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ * var JST = {\ * "main": ' + _.template(mainText).source + '\ * };\ diff --git a/lodash.template/package.json b/lodash.template/package.json index 302595fe4..3a48712e7 100644 --- a/lodash.template/package.json +++ b/lodash.template/package.json @@ -1,6 +1,6 @@ { "name": "lodash.template", - "version": "4.2.4", + "version": "4.2.5", "description": "The lodash method `_.template` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg",