mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Bump to v3.2.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# lodash.template v3.0.1
|
||||
# lodash.template v3.2.0
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.template` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
||||
|
||||
@@ -17,4 +17,4 @@ In Node.js/io.js:
|
||||
var template = require('lodash.template');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/3.0.1-npm-packages/lodash.template) for more details.
|
||||
See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.template) for more details.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
|
||||
* lodash 3.2.0 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
|
||||
@@ -7,14 +7,16 @@
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
var baseCopy = require('lodash._basecopy'),
|
||||
baseToString = require('lodash._basetostring'),
|
||||
baseSlice = require('lodash._baseslice'),
|
||||
baseValues = require('lodash._basevalues'),
|
||||
isIterateeCall = require('lodash._isiterateecall'),
|
||||
reInterpolate = require('lodash._reinterpolate'),
|
||||
isError = require('lodash.iserror'),
|
||||
keys = require('lodash.keys'),
|
||||
templateSettings = require('lodash.templatesettings');
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var errorTag = '[object Error]';
|
||||
|
||||
/** Used to match empty string literals in compiled template source. */
|
||||
var reEmptyStringLeading = /\b__p \+= '';/g,
|
||||
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
||||
@@ -43,6 +45,21 @@ var stringEscapes = {
|
||||
'\u2029': 'u2029'
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts `value` to a string if it is not one. An empty string is returned
|
||||
* for `null` or `undefined` values.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to process.
|
||||
* @returns {string} Returns the string.
|
||||
*/
|
||||
function baseToString(value) {
|
||||
if (typeof value == 'string') {
|
||||
return value;
|
||||
}
|
||||
return value == null ? '' : (value + '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.template` to escape characters for inclusion in compiled
|
||||
* string literals.
|
||||
@@ -55,12 +72,30 @@ function escapeStringChar(chr) {
|
||||
return '\\' + stringEscapes[chr];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is object-like.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return (value && typeof value == 'object') || false;
|
||||
}
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the `toStringTag` of values.
|
||||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* for more details.
|
||||
*/
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
/**
|
||||
* Used by `_.template` to customize its `_.assign` use.
|
||||
*
|
||||
@@ -96,7 +131,7 @@ function baseAssign(object, source, customizer) {
|
||||
return baseCopy(source, object, props);
|
||||
}
|
||||
var index = -1,
|
||||
length = props.length
|
||||
length = props.length;
|
||||
|
||||
while (++index < length) {
|
||||
var key = props[index],
|
||||
@@ -111,6 +146,27 @@ function baseAssign(object, source, customizer) {
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
||||
* `SyntaxError`, `TypeError`, or `URIError` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isError(new Error);
|
||||
* // => true
|
||||
*
|
||||
* _.isError(Error);
|
||||
* // => false
|
||||
*/
|
||||
function isError(value) {
|
||||
return (isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag) || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a compiled template function that can interpolate data properties
|
||||
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
||||
@@ -310,8 +366,8 @@ function template(string, options, otherOptions) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to invoke `func`, returning either the result or the caught
|
||||
* error object.
|
||||
* Attempts to invoke `func`, returning either the result or the caught error
|
||||
* object. Any additional arguments are provided to `func` when it is invoked.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -321,9 +377,9 @@ function template(string, options, otherOptions) {
|
||||
* @example
|
||||
*
|
||||
* // avoid throwing errors for invalid selectors
|
||||
* var elements = _.attempt(function() {
|
||||
* var elements = _.attempt(function(selector) {
|
||||
* return document.querySelectorAll(selector);
|
||||
* });
|
||||
* }, '>_>');
|
||||
*
|
||||
* if (_.isError(elements)) {
|
||||
* elements = [];
|
||||
@@ -331,9 +387,9 @@ function template(string, options, otherOptions) {
|
||||
*/
|
||||
function attempt(func) {
|
||||
try {
|
||||
return func();
|
||||
return func.apply(undefined, baseSlice(arguments, 1));
|
||||
} catch(e) {
|
||||
return isError(e) ? e : Error(e);
|
||||
return isError(e) ? e : new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash.template",
|
||||
"version": "3.0.1",
|
||||
"version": "3.2.0",
|
||||
"description": "The modern build of lodash’s `_.template` as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
@@ -18,11 +18,10 @@
|
||||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
|
||||
"dependencies": {
|
||||
"lodash._basecopy": "^3.0.0",
|
||||
"lodash._basetostring": "^3.0.0",
|
||||
"lodash._baseslice": "^3.0.0",
|
||||
"lodash._basevalues": "^3.0.0",
|
||||
"lodash._isiterateecall": "^3.0.0",
|
||||
"lodash._reinterpolate": "^3.0.0",
|
||||
"lodash.iserror": "^3.0.0",
|
||||
"lodash.keys": "^3.0.0",
|
||||
"lodash.templatesettings": "^3.0.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user