mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Allow compiled templates loaded via AMD to set and use the private _ variable.
Former-commit-id: 746e6d8275f08dbb628e92c146fffba84df0f8c0
This commit is contained in:
3
build.js
3
build.js
@@ -336,6 +336,7 @@
|
||||
source.push(
|
||||
" if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {",
|
||||
" define(['" + options.moduleId + "'], function(lodash) {",
|
||||
' _ = lodash;',
|
||||
' lodash.templates = lodash.extend(lodash.templates || {}, templates);',
|
||||
' });',
|
||||
" } else if (freeExports) {",
|
||||
@@ -1050,7 +1051,7 @@
|
||||
var templateSettings = options.reduce(function(result, value) {
|
||||
var match = value.match(/settings=(.+)$/);
|
||||
return match
|
||||
? Function('assign, result', 'return assign(result, {' + match[1].replace(/^{|}$/g, '') + '})')(_.assign, result)
|
||||
? _.assign(result, Function('return {' + match[1].replace(/^{|}$/g, '') + '}')())
|
||||
: result;
|
||||
}, _.assign(_.clone(_.templateSettings), {
|
||||
'moduleId': moduleId
|
||||
|
||||
Reference in New Issue
Block a user