mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
# add dist
This commit is contained in:
34
ng2-components/ng2-alfresco-documentslist/dist/node_modules/es6-template-strings/resolve.js
generated
vendored
Normal file
34
ng2-components/ng2-alfresco-documentslist/dist/node_modules/es6-template-strings/resolve.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
var value = require('es5-ext/object/valid-value')
|
||||
, normalize = require('es5-ext/object/normalize-options')
|
||||
|
||||
, map = Array.prototype.map, keys = Object.keys
|
||||
, stringify = JSON.stringify;
|
||||
|
||||
module.exports = function (data, context/*, options*/) {
|
||||
var names, argNames, argValues, options = Object(arguments[2]);
|
||||
|
||||
(value(data) && value(data.literals) && value(data.substitutions));
|
||||
context = normalize(context);
|
||||
names = keys(context);
|
||||
argNames = names.join(', ');
|
||||
argValues = names.map(function (name) { return context[name]; });
|
||||
return [data.literals].concat(map.call(data.substitutions, function (expr) {
|
||||
var resolver;
|
||||
if (!expr) return undefined;
|
||||
try {
|
||||
resolver = new Function(argNames, 'return (' + expr + ')');
|
||||
} catch (e) {
|
||||
throw new TypeError("Unable to compile expression:\n\targs: " + stringify(argNames) +
|
||||
"\n\tbody: " + stringify(expr) + "\n\terror: " + e.stack);
|
||||
}
|
||||
try {
|
||||
return resolver.apply(null, argValues);
|
||||
} catch (e) {
|
||||
if (options.partial) return '${' + expr + '}';
|
||||
throw new TypeError("Unable to resolve expression:\n\targs: " + stringify(argNames) +
|
||||
"\n\tbody: " + stringify(expr) + "\n\terror: " + e.stack);
|
||||
}
|
||||
}));
|
||||
};
|
Reference in New Issue
Block a user