mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-15 05:07:49 +00:00
Remove legacy options param signature from _.template.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -12287,7 +12287,7 @@
|
||||
* @param {RegExp} [options.interpolate] The "interpolate" delimiter.
|
||||
* @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
|
||||
* @param {string} [options.variable] The data object variable name.
|
||||
* @param- {Object} [otherOptions] Enables the legacy `options` param signature.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
|
||||
* @returns {Function} Returns the compiled template function.
|
||||
* @example
|
||||
*
|
||||
@@ -12355,16 +12355,16 @@
|
||||
* };\
|
||||
* ');
|
||||
*/
|
||||
function template(string, options, otherOptions) {
|
||||
function template(string, options, guard) {
|
||||
// Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/)
|
||||
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
|
||||
var settings = lodash.templateSettings;
|
||||
|
||||
if (otherOptions && isIterateeCall(string, options, otherOptions)) {
|
||||
options = otherOptions = undefined;
|
||||
if (guard && isIterateeCall(string, options, guard)) {
|
||||
options = undefined;
|
||||
}
|
||||
string = toString(string);
|
||||
options = assignInWith({}, otherOptions || options, settings, assignInDefaults);
|
||||
options = assignInWith({}, options, settings, assignInDefaults);
|
||||
|
||||
var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults),
|
||||
importsKeys = keys(imports),
|
||||
|
||||
@@ -19208,15 +19208,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test('should support the legacy `options` argument signature', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var compiled = _.template('<%= data.a %>', null, { 'variable': 'data' }),
|
||||
data = { 'a': 1 };
|
||||
|
||||
assert.strictEqual(compiled(data), '1');
|
||||
});
|
||||
|
||||
QUnit.test('should support custom delimiters', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user