NUEVA BUSQUEDA DE DATOS SRI
This commit is contained in:
90
node_modules/ejs/lib/utils.js
generated
vendored
90
node_modules/ejs/lib/utils.js
generated
vendored
@@ -25,6 +25,8 @@
|
||||
'use strict';
|
||||
|
||||
var regExpChars = /[|\\{}()[\]^$+*?.]/g;
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var hasOwn = function (obj, key) { return hasOwnProperty.apply(obj, [key]); };
|
||||
|
||||
/**
|
||||
* Escape characters reserved in regular expressions.
|
||||
@@ -97,9 +99,25 @@ exports.escapeXML = function (markup) {
|
||||
: String(markup)
|
||||
.replace(_MATCH_HTML, encode_char);
|
||||
};
|
||||
exports.escapeXML.toString = function () {
|
||||
|
||||
function escapeXMLToString() {
|
||||
return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr;
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
if (typeof Object.defineProperty === 'function') {
|
||||
// If the Function prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
|
||||
// cannot have the property changed using an assignment. If using strict mode, attempting that will cause an error. If not using strict
|
||||
// mode, attempting that will be silently ignored.
|
||||
// However, we can still explicitly shadow the prototype's "toString" property by defining a new "toString" property on this object.
|
||||
Object.defineProperty(exports.escapeXML, 'toString', { value: escapeXMLToString });
|
||||
} else {
|
||||
// If Object.defineProperty() doesn't exist, attempt to shadow this property using the assignment operator.
|
||||
exports.escapeXML.toString = escapeXMLToString;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Unable to set escapeXML.toString (is the Function prototype frozen?)');
|
||||
}
|
||||
|
||||
/**
|
||||
* Naive copy of properties from one object to another.
|
||||
@@ -114,8 +132,16 @@ exports.escapeXML.toString = function () {
|
||||
*/
|
||||
exports.shallowCopy = function (to, from) {
|
||||
from = from || {};
|
||||
for (var p in from) {
|
||||
to[p] = from[p];
|
||||
if ((to !== null) && (to !== undefined)) {
|
||||
for (var p in from) {
|
||||
if (!hasOwn(from, p)) {
|
||||
continue;
|
||||
}
|
||||
if (p === '__proto__' || p === 'constructor') {
|
||||
continue;
|
||||
}
|
||||
to[p] = from[p];
|
||||
}
|
||||
}
|
||||
return to;
|
||||
};
|
||||
@@ -133,10 +159,20 @@ exports.shallowCopy = function (to, from) {
|
||||
* @private
|
||||
*/
|
||||
exports.shallowCopyFromList = function (to, from, list) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var p = list[i];
|
||||
if (typeof from[p] != 'undefined') {
|
||||
to[p] = from[p];
|
||||
list = list || [];
|
||||
from = from || {};
|
||||
if ((to !== null) && (to !== undefined)) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var p = list[i];
|
||||
if (typeof from[p] != 'undefined') {
|
||||
if (!hasOwn(from, p)) {
|
||||
continue;
|
||||
}
|
||||
if (p === '__proto__' || p === 'constructor') {
|
||||
continue;
|
||||
}
|
||||
to[p] = from[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
return to;
|
||||
@@ -165,3 +201,41 @@ exports.cache = {
|
||||
this._data = {};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Transforms hyphen case variable into camel case.
|
||||
*
|
||||
* @param {String} string Hyphen case string
|
||||
* @return {String} Camel case string
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
exports.hyphenToCamel = function (str) {
|
||||
return str.replace(/-[a-z]/g, function (match) { return match[1].toUpperCase(); });
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a null-prototype object in runtimes that support it
|
||||
*
|
||||
* @return {Object} Object, prototype will be set to null where possible
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
exports.createNullProtoObjWherePossible = (function () {
|
||||
if (typeof Object.create == 'function') {
|
||||
return function () {
|
||||
return Object.create(null);
|
||||
};
|
||||
}
|
||||
if (!({__proto__: null} instanceof Object)) {
|
||||
return function () {
|
||||
return {__proto__: null};
|
||||
};
|
||||
}
|
||||
// Not possible, just pass through
|
||||
return function () {
|
||||
return {};
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user