fix #1624 Rules added with embedRules can only use stringed regexes
This commit is contained in:
parent
93a88fcb5e
commit
150f0360d4
1 changed files with 7 additions and 5 deletions
|
|
@ -78,14 +78,16 @@ exports.copyArray = function(array){
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.deepCopy = function (obj) {
|
exports.deepCopy = function (obj) {
|
||||||
if (typeof obj != "object") {
|
if (typeof obj !== "object" || !obj)
|
||||||
|
return obj;
|
||||||
|
var cons = obj.constructor;
|
||||||
|
if (cons === RegExp)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
|
||||||
|
|
||||||
var copy = obj.constructor();
|
var copy = cons();
|
||||||
for (var key in obj) {
|
for (var key in obj) {
|
||||||
if (typeof obj[key] == "object") {
|
if (typeof obj[key] === "object") {
|
||||||
copy[key] = this.deepCopy(obj[key]);
|
copy[key] = exports.deepCopy(obj[key]);
|
||||||
} else {
|
} else {
|
||||||
copy[key] = obj[key];
|
copy[key] = obj[key];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue