Area restrita - Questionario
This commit is contained in:
+4
-16
@@ -1,5 +1,4 @@
|
||||
var arrayEach = require('./_arrayEach'),
|
||||
assignWith = require('./assignWith'),
|
||||
var assignInWith = require('./assignInWith'),
|
||||
attempt = require('./attempt'),
|
||||
baseValues = require('./_baseValues'),
|
||||
customDefaultsAssignIn = require('./_customDefaultsAssignIn'),
|
||||
@@ -12,8 +11,7 @@ var arrayEach = require('./_arrayEach'),
|
||||
toString = require('./toString');
|
||||
|
||||
/** Error message constants. */
|
||||
var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`',
|
||||
INVALID_TEMPL_IMPORTS_ERROR_TEXT = 'Invalid `imports` option passed into `_.template`';
|
||||
var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
|
||||
|
||||
/** Used to match empty string literals in compiled template source. */
|
||||
var reEmptyStringLeading = /\b__p \+= '';/g,
|
||||
@@ -57,10 +55,6 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
* properties may be accessed as free variables in the template. If a setting
|
||||
* object is given, it takes precedence over `_.templateSettings` values.
|
||||
*
|
||||
* **Security:** `_.template` is insecure and should not be used. It will be
|
||||
* removed in Lodash v5. Avoid untrusted input. See
|
||||
* [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md).
|
||||
*
|
||||
* **Note:** In the development build `_.template` utilizes
|
||||
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
||||
* for easier debugging.
|
||||
@@ -168,18 +162,12 @@ function template(string, options, guard) {
|
||||
options = undefined;
|
||||
}
|
||||
string = toString(string);
|
||||
options = assignWith({}, options, settings, customDefaultsAssignIn);
|
||||
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
||||
|
||||
var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
||||
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
||||
importsKeys = keys(imports),
|
||||
importsValues = baseValues(imports, importsKeys);
|
||||
|
||||
arrayEach(importsKeys, function(key) {
|
||||
if (reForbiddenIdentifierChars.test(key)) {
|
||||
throw new Error(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
|
||||
}
|
||||
});
|
||||
|
||||
var isEscaping,
|
||||
isEvaluating,
|
||||
index = 0,
|
||||
|
||||
Reference in New Issue
Block a user