From f39fdc42f6e08d28ee777758c48bf12b001b3c6e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 3 Jan 2016 16:53:19 -0600 Subject: [PATCH] Remove legacy `options` param signature from `_.template`. --- lodash.js | 10 +++++----- test/test.js | 9 --------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lodash.js b/lodash.js index 00dc0a240..fdae8dfbf 100644 --- a/lodash.js +++ b/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), diff --git a/test/test.js b/test/test.js index d34d6810d..336c92e9f 100644 --- a/test/test.js +++ b/test/test.js @@ -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);