1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 this.EXPORTED_SYMBOLS = [
13 * Perform a deep copy of an Array or Object.
15 deepCopy: function deepCopy(thing, noSort) {
16 if (typeof(thing) != "object" || thing == null) {
20 if (Array.isArray(thing)) {
22 for (let element of thing) {
23 ret.push(this.deepCopy(element, noSort));
30 let props = [p for (p in thing)];
36 for (let prop of props) {
37 ret[prop] = this.deepCopy(thing[prop], noSort);