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) {
|
||||
if (typeof obj != "object") {
|
||||
if (typeof obj !== "object" || !obj)
|
||||
return obj;
|
||||
var cons = obj.constructor;
|
||||
if (cons === RegExp)
|
||||
return obj;
|
||||
}
|
||||
|
||||
var copy = obj.constructor();
|
||||
var copy = cons();
|
||||
for (var key in obj) {
|
||||
if (typeof obj[key] == "object") {
|
||||
copy[key] = this.deepCopy(obj[key]);
|
||||
if (typeof obj[key] === "object") {
|
||||
copy[key] = exports.deepCopy(obj[key]);
|
||||
} else {
|
||||
copy[key] = obj[key];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue