Move deepCopy into pilot/lang

This commit is contained in:
c-spencer 2011-05-27 10:48:28 +01:00
commit e153f53852

View file

@ -37,6 +37,8 @@
define(function(require, exports, module) {
var lang = require("pilot/lang");
var TextHighlightRules = function() {
// regexp must not have capturing parentheses
@ -53,19 +55,6 @@ var TextHighlightRules = function() {
};
};
// Could probably do with improving and moving into lang.
var deepCopy = function (o) {
var clone = o.constructor();
for (var k in o) {
if (typeof o[k] === "object") {
clone[k] = deepCopy(o[k]);
} else {
clone[k] = o[k];
}
}
return clone;
};
(function() {
this.addRules = function(rules, prefix) {
@ -103,7 +92,7 @@ var deepCopy = function (o) {
this.addRules(embedRules, prefix);
for (var i = 0; i < states.length; i++) {
Array.prototype.unshift.apply(this.$rules[states[i]], deepCopy(escapeRules));
Array.prototype.unshift.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
}
if (!this.$embeds) {