lodash.template
Advanced tools
Comparing version 3.4.0 to 3.5.0
145
index.js
/** | ||
* lodash 3.4.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.5.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.8.2 <http://underscorejs.org/LICENSE> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
@@ -15,2 +15,3 @@ * Available under MIT license <https://lodash.com/license> | ||
escape = require('lodash.escape'), | ||
isNative = require('lodash.isnative'), | ||
keys = require('lodash.keys'), | ||
@@ -28,5 +29,3 @@ restParam = require('lodash.restparam'), | ||
/** | ||
* Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). | ||
*/ | ||
/** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */ | ||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; | ||
@@ -74,3 +73,4 @@ | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
var arrayProto = Array.prototype, | ||
objectProto = Object.prototype; | ||
@@ -86,6 +86,27 @@ /** Used to check objects for own properties. */ | ||
/** Native method references. */ | ||
var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, | ||
push = arrayProto.push, | ||
preventExtensions = isNative(Object.preventExtensions = Object.preventExtensions) && preventExtensions; | ||
/** Used as `baseAssign`. */ | ||
var nativeAssign = (function() { | ||
// Avoid `Object.assign` in Firefox 34-37 which have an early implementation | ||
// with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344 | ||
// for more details. | ||
// | ||
// Use `Object.preventExtensions` on a plain object instead of simply using | ||
// `Object('x')` because Chrome and IE fail to throw an error when attempting | ||
// to assign values to readonly indexes of strings in strict mode. | ||
var object = { '1': 0 }, | ||
func = preventExtensions && isNative(func = Object.assign) && func; | ||
try { func(preventExtensions(object), 'xo'); } catch(e) {} | ||
return !object[1] && func; | ||
}()); | ||
/** | ||
* Used by `_.template` to customize its `_.assign` use. | ||
* | ||
* **Note:** This method is like `assignDefaults` except that it ignores | ||
* **Note:** This function is like `assignDefaults` except that it ignores | ||
* inherited property values when checking if a property is `undefined`. | ||
@@ -101,3 +122,3 @@ * | ||
function assignOwnDefaults(objectValue, sourceValue, key, object) { | ||
return (typeof objectValue == 'undefined' || !hasOwnProperty.call(object, key)) | ||
return (objectValue === undefined || !hasOwnProperty.call(object, key)) | ||
? sourceValue | ||
@@ -108,4 +129,5 @@ : objectValue; | ||
/** | ||
* The base implementation of `_.assign` without support for argument juggling, | ||
* multiple sources, and `this` binding `customizer` functions. | ||
* A specialized version of `_.assign` for customizing assigned values without | ||
* support for argument juggling, multiple sources, and `this` binding `customizer` | ||
* functions. | ||
* | ||
@@ -115,10 +137,9 @@ * @private | ||
* @param {Object} source The source object. | ||
* @param {Function} [customizer] The function to customize assigning values. | ||
* @returns {Object} Returns the destination object. | ||
* @param {Function} customizer The function to customize assigned values. | ||
* @returns {Object} Returns `object`. | ||
*/ | ||
function baseAssign(object, source, customizer) { | ||
function assignWith(object, source, customizer) { | ||
var props = keys(source); | ||
if (!customizer) { | ||
return baseCopy(source, object, props); | ||
} | ||
push.apply(props, getSymbols(source)); | ||
var index = -1, | ||
@@ -133,3 +154,3 @@ length = props.length; | ||
if ((result === result ? (result !== value) : (value === value)) || | ||
(typeof value == 'undefined' && !(key in object))) { | ||
(value === undefined && !(key in object))) { | ||
object[key] = result; | ||
@@ -142,2 +163,39 @@ } | ||
/** | ||
* The base implementation of `_.assign` without support for argument juggling, | ||
* multiple sources, and `customizer` functions. | ||
* | ||
* @private | ||
* @param {Object} object The destination object. | ||
* @param {Object} source The source object. | ||
* @returns {Object} Returns `object`. | ||
*/ | ||
var baseAssign = nativeAssign || function(object, source) { | ||
return source == null | ||
? object | ||
: baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object)); | ||
}; | ||
/** | ||
* Creates an array of the own symbols of `object`. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the array of symbols. | ||
*/ | ||
var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) { | ||
return getOwnPropertySymbols(toObject(object)); | ||
}; | ||
/** | ||
* Converts `value` to an object if it is not one. | ||
* | ||
* @private | ||
* @param {*} value The value to process. | ||
* @returns {Object} Returns the object. | ||
*/ | ||
function toObject(value) { | ||
return isObject(value) ? value : Object(value); | ||
} | ||
/** | ||
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, | ||
@@ -164,2 +222,29 @@ * `SyntaxError`, `TypeError`, or `URIError` object. | ||
/** | ||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
* @example | ||
* | ||
* _.isObject({}); | ||
* // => true | ||
* | ||
* _.isObject([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObject(1); | ||
* // => false | ||
*/ | ||
function isObject(value) { | ||
// Avoid a V8 JIT bug in Chrome 19-20. | ||
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
var type = typeof value; | ||
return type == 'function' || (!!value && type == 'object'); | ||
} | ||
/** | ||
* Creates a compiled template function that can interpolate data properties | ||
@@ -269,5 +354,5 @@ * in "interpolate" delimiters, HTML-escape interpolated data properties in | ||
string = baseToString(string); | ||
options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); | ||
options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); | ||
var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), | ||
var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), | ||
importsKeys = keys(imports), | ||
@@ -391,2 +476,24 @@ importsValues = baseValues(imports, importsKeys); | ||
/** | ||
* Creates a function that returns `value`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Utility | ||
* @param {*} value The value to return from the new function. | ||
* @returns {Function} Returns the new function. | ||
* @example | ||
* | ||
* var object = { 'user': 'fred' }; | ||
* var getter = _.constant(object); | ||
* | ||
* getter() === object; | ||
* // => true | ||
*/ | ||
function constant(value) { | ||
return function() { | ||
return value; | ||
}; | ||
} | ||
module.exports = template; |
{ | ||
"name": "lodash.template", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "The modern build of lodash’s `_.template` as a module.", | ||
@@ -26,2 +26,3 @@ "homepage": "https://lodash.com/", | ||
"lodash.escape": "^3.0.0", | ||
"lodash.isnative": "^3.0.0", | ||
"lodash.keys": "^3.0.0", | ||
@@ -28,0 +29,0 @@ "lodash.restparam": "^3.0.0", |
@@ -1,2 +0,2 @@ | ||
# lodash.template v3.4.0 | ||
# lodash.template v3.5.0 | ||
@@ -20,2 +20,2 @@ 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. | ||
See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/3.4.0-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.5.0-npm-packages/lodash.template) for more details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19683
445
10
+ Addedlodash.isnative@^3.0.0
+ Addedlodash.isnative@3.0.7(transitive)