Move deepCopy into pilot/lang
This commit is contained in:
parent
5d1abb6bfc
commit
e153f53852
1 changed files with 3 additions and 14 deletions
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
|
var lang = require("pilot/lang");
|
||||||
|
|
||||||
var TextHighlightRules = function() {
|
var TextHighlightRules = function() {
|
||||||
|
|
||||||
// regexp must not have capturing parentheses
|
// 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() {
|
(function() {
|
||||||
|
|
||||||
this.addRules = function(rules, prefix) {
|
this.addRules = function(rules, prefix) {
|
||||||
|
|
@ -103,7 +92,7 @@ var deepCopy = function (o) {
|
||||||
this.addRules(embedRules, prefix);
|
this.addRules(embedRules, prefix);
|
||||||
|
|
||||||
for (var i = 0; i < states.length; i++) {
|
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) {
|
if (!this.$embeds) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue