1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-19 16:27:58 +01:00

Rename 'array' class 'Ary'.

This commit is contained in:
Kris Maglione
2015-03-04 17:27:32 -08:00
parent 313fa1c333
commit d6543c6510
36 changed files with 239 additions and 232 deletions

View File

@@ -56,7 +56,7 @@ var Abbreviation = Class("Abbreviation", {
* @param {[Mode]} modes The modes to test.
* @returns {boolean} The result of the comparison.
*/
modesEqual: function (modes) array.equals(this.modes, modes),
modesEqual: function (modes) Ary.equals(this.modes, modes),
/**
* Returns true if this abbreviation is defined for *mode*.
@@ -91,7 +91,7 @@ var Abbreviation = Class("Abbreviation", {
get modeChar() Abbreviation.modeChar(this.modes)
}, {
modeChar: function (_modes) {
let result = array.uniq(_modes.map(m => m.char)).join("");
let result = Ary.uniq(_modes.map(m => m.char)).join("");
if (result == "ci")
result = "!";
return result;
@@ -352,7 +352,7 @@ var Abbreviations = Module("abbreviations", {
description: "Expand this abbreviation by evaluating its right-hand-side as JavaScript"
}
],
serialize: function () array(abbreviations.userHives)
serialize: function () Ary(abbreviations.userHives)
.filter(h => h.persist)
.map(hive => [
{

View File

@@ -23,7 +23,7 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
this._store = [];
},
"@@iterator": function () array.iterValues(this._store),
"@@iterator": function () this._store[Symbol.iterator](),
/**
* Adds a new autocommand. *cmd* will be executed when one of the specified

View File

@@ -437,7 +437,7 @@ var Bookmarks = Module("bookmarks", {
names: ["-tags", "-T"],
description: "A comma-separated list of tags",
completer: function tags(context, args) {
context.generate = function () array(b.tags
context.generate = function () Ary(b.tags
for (b in bookmarkcache)
if (b.tags))
.flatten().uniq().array;
@@ -593,7 +593,7 @@ var Bookmarks = Module("bookmarks", {
bang: true,
completer: function completer(context, args)
completion.bookmark(context, args["-tags"], { keyword: args["-keyword"], title: args["-title"] }),
domains: function (args) array.compact(args.map(util.getHost)),
domains: function (args) Ary.compact(args.map(util.getHost)),
literal: 0,
options: [tags, title, keyword],
privateData: true
@@ -758,7 +758,7 @@ var Bookmarks = Module("bookmarks", {
ctxt.cache.request = bookmarks.getSuggestions(name, ctxt.filter);
ctxt.cache.request.then(function (compl) {
ctxt.incomplete = false;
ctxt.completions = array.uniq(ctxt.completions.filter(c => ~compl.indexOf(c))
ctxt.completions = Ary.uniq(ctxt.completions.filter(c => ~compl.indexOf(c))
.concat(compl), true);
}).catch(function (e) {
ctxt.incomplete = false;

View File

@@ -211,7 +211,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
function (args) { dactyl.open(args[0] || "about:blank"); },
{
completer: function (context) completion.url(context),
domains: function (args) array.compact(dactyl.parseURLs(args[0] || "")
domains: function (args) Ary.compact(dactyl.parseURLs(args[0] || "")
.map(url => util.getHost(url))),
literal: 0,
privateData: true
@@ -229,7 +229,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
{ argCount: "0" });
},
mappings: function initMappings(dactyl, modules, window) {
let openModes = array.toObject([
let openModes = Ary.toObject([
[dactyl.CURRENT_TAB, ""],
[dactyl.NEW_TAB, "tab"],
[dactyl.NEW_BACKGROUND_TAB, "background tab"],

View File

@@ -1219,7 +1219,7 @@ var CommandLine = Module("commandline", {
get selected() this.itemList.selected,
set selected(tuple) {
if (!array.equals(tuple || [],
if (!Ary.equals(tuple || [],
this.itemList.selected || []))
this.itemList.select(tuple);

View File

@@ -235,7 +235,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let name = commands.add(params.name, params.description,
function (args) {
let results = array(params.iterate(args))
let results = Ary(params.iterate(args))
.sort((a, b) => String.localeCompare(a.name, b.name));
let filters = args.map(arg => {
@@ -256,7 +256,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
context.keys.description = function () seen[this.text] + /*L*/" matching items";
context.ignoreCase = true;
let seen = {};
context.completions = array(keys(item).join(" ").toLowerCase().split(/[()\s]+/)
context.completions = Ary(keys(item).join(" ").toLowerCase().split(/[()\s]+/)
for (item of params.iterate(args)))
.flatten()
.map(function (k) {
@@ -269,7 +269,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (params.index)
this.indices[params.index] = function* () {
let results = array((params.iterateIndex || params.iterate).call(params, commands.get(name).newArgs()))
let results = Ary((params.iterateIndex || params.iterate).call(params, commands.get(name).newArgs()))
.array.sort((a, b) => String.localeCompare(a.name, b.name));
for (let obj of values(results)) {
@@ -1403,7 +1403,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
"rb" + [k for ([k, v] of iter(groups[1].opts))
if (!Dactyl.toolbarHidden(document.getElementById(v[1][0])))].join(""),
values: array(groups).map(g => [[k, v[0]] for ([k, v] of iter(g.opts))])
values: Ary(groups).map(g => [[k, v[0]] for ([k, v] of iter(g.opts))])
.flatten(),
setter: function (value) {

View File

@@ -24,7 +24,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
_events: function _events(event, callback) {
if (!isObject(event))
var [self, events] = [null, array.toObject([[event, callback]])];
var [self, events] = [null, Ary.toObject([[event, callback]])];
else
[self, events] = [event, event[callback || "events"]];
@@ -1148,7 +1148,7 @@ var Events = Module("events", {
"sitemap", "", {
flush: function flush() {
memoize(this, "filters", function () this.value.filter(function (f) f(buffer.documentURI)));
memoize(this, "pass", function () new RealSet(array.flatten(this.filters.map(function (f) f.keys))));
memoize(this, "pass", function () new RealSet(Ary.flatten(this.filters.map(function (f) f.keys))));
memoize(this, "commandHive", function hive() Hive(this.filters, "command"));
memoize(this, "inputHive", function hive() Hive(this.filters, "input"));
},

View File

@@ -286,7 +286,7 @@ var HintSession = Class("HintSession", CommandMode, {
memoize(doc, "dactylLabels", () =>
iter([l.getAttribute("for"), l]
for (l of array.iterValues(doc.querySelectorAll("label[for]"))))
for (l of doc.querySelectorAll("label[for]")))
.toObject());
let [offsetX, offsetY] = this.getContainerOffsets(doc);
@@ -1362,7 +1362,7 @@ var Hints = Module("hints", {
},
validator: function (value) {
let values = DOM.Event.parse(value).map(DOM.Event.bound.stringify);
return Option.validIf(array.uniq(values).length === values.length && values.length > 1,
return Option.validIf(Ary.uniq(values).length === values.length && values.length > 1,
_("option.hintkeys.duplicate"));
}
});

View File

@@ -65,7 +65,7 @@ var History = Module("history", {
let obj = [];
obj.__defineGetter__("index", () => sh.index);
obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val); });
obj[Symbol.iterator] = function () array.iterItems(this);
obj[Symbol.iterator] = function () this.entries();
for (let item of iter(sh.SHistoryEnumerator, Ci.nsISHEntry))
obj.push(update(Object.create(item), {
@@ -276,7 +276,7 @@ var History = Module("history", {
description: "The sort order of the results",
completer: function (context, args) {
context.compare = CompletionContext.Sort.unsorted;
return array.flatten([
return Ary.flatten([
"annotation",
"date",
"date added",

View File

@@ -17,7 +17,7 @@ var ProcessorStack = Class("ProcessorStack", {
events.dbg("STACK " + mode);
let main = { __proto__: mode.main, params: mode.params };
this.modes = array([mode.params.keyModes, main, mode.main.allBases.slice(1)]).flatten().compact();
this.modes = Ary([mode.params.keyModes, main, mode.main.allBases.slice(1)]).flatten().compact();
if (builtin)
hives = hives.filter(h => h.name === "builtin");

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2014 Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2015 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -107,7 +107,7 @@ var Map = Class("Map", {
*/
hasName: function (name) this.keys.indexOf(name) >= 0,
get keys() array.flatten(this.names.map(mappings.bound.expand)),
get keys() Ary.flatten(this.names.map(mappings.bound.expand)),
/**
* Execute the action for this mapping.
@@ -284,7 +284,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
return self;
},
"@@iterator": function () array.iterValues(this),
"@@iterator": function () Ary.iterValues(this),
get candidates() this.states.candidates,
get mappings() this.states.mappings,
@@ -367,12 +367,16 @@ var Mappings = Module("mappings", {
expand: function expand(keys) {
if (!/<\*-/.test(keys))
var res = keys;
else
res = util.debrace(DOM.Event.iterKeys(keys).map(function (key) {
else {
let globbed = DOM.Event.iterKeys(keys)
.map(key => {
if (/^<\*-/.test(key))
return ["<", this.prefixes, key.slice(3)];
return key;
}, this).flatten().array).map(k => DOM.Event.canonicalKeys(k));
}).flatten().array;
res = util.debrace(globbed).map(k => DOM.Event.canonicalKeys(k));
}
if (keys != arguments[0])
return [arguments[0]].concat(keys);
@@ -382,7 +386,7 @@ var Mappings = Module("mappings", {
iterate: function* (mode) {
let seen = new RealSet;
for (let hive of this.hives.iterValues())
for (let map of array(hive.getStack(mode)).iterValues())
for (let map of Ary.iterValues(hive.getStack(mode)))
if (!seen.add(map.name))
yield map;
},
@@ -521,7 +525,7 @@ var Mappings = Module("mappings", {
commands: function initCommands(dactyl, modules, window) {
function addMapCommands(ch, mapmodes, modeDescription) {
function map(args, noremap) {
let mapmodes = array.uniq(args["-modes"].map(findMode));
let mapmodes = Ary.uniq(args["-modes"].map(findMode));
let hives = args.explicitOpts["-group"] ? [args["-group"]] : null;
if (!args.length) {
@@ -561,7 +565,7 @@ var Mappings = Module("mappings", {
const opts = {
identifier: "map",
completer: function (context, args) {
let mapmodes = array.uniq(args["-modes"].map(findMode));
let mapmodes = Ary.uniq(args["-modes"].map(findMode));
if (args.length == 1)
return completion.userMapping(context, mapmodes, args["-group"]);
if (args.length == 2) {
@@ -618,7 +622,7 @@ var Mappings = Module("mappings", {
],
serialize: function () {
return this.name != "map" ? [] :
array(mappings.userHives)
Ary(mappings.userHives)
.filter(h => h.persist)
.map(hive => [
{
@@ -643,7 +647,7 @@ var Mappings = Module("mappings", {
function* userMappings(hive) {
let seen = new RealSet;
for (let stack of values(hive.stacks))
for (let map of array.iterValues(stack))
for (let map of Ary.iterValues(stack))
if (!seen.add(map.id))
yield map;
}
@@ -666,7 +670,7 @@ var Mappings = Module("mappings", {
util.assert(args.bang ^ !!args[0], _("error.argumentOrBang"));
let mapmodes = array.uniq(args["-modes"].map(findMode));
let mapmodes = Ary.uniq(args["-modes"].map(findMode));
let found = 0;
for (let mode of values(mapmodes))
@@ -701,7 +705,7 @@ var Mappings = Module("mappings", {
names: ["-mode", "-m"],
type: CommandOption.STRING,
validator: function (value) Array.concat(value).every(findMode),
completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.description]
completer: function () [[Ary.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.description]
for (mode of values(modes.all))
if (!mode.hidden)]
};
@@ -718,7 +722,7 @@ var Mappings = Module("mappings", {
let chars = [k for ([k, v] of iter(modules.modes.modeChars))
if (v.every(mode => modes.indexOf(mode) >= 0))];
return array.uniq(modes.filter(m => chars.indexOf(m.char) < 0)
return Ary.uniq(modes.filter(m => chars.indexOf(m.char) < 0)
.map(m => m.name.toLowerCase())
.concat(chars));
}
@@ -756,7 +760,7 @@ var Mappings = Module("mappings", {
// Bloody hell. --Kris
for (let [i, mode] of iter(modes))
for (let hive of mappings.hives.iterValues())
for (let map of array.iterValues(hive.getStack(mode)))
for (let map of Ary.iterValues(hive.getStack(mode)))
for (let name of values(map.names))
if (!seen.add(name))
yield {
@@ -779,7 +783,7 @@ var Mappings = Module("mappings", {
template.linkifyHelp(map.description + (map.rhs ? ": " + map.rhs : ""))
],
help: function (map) {
let char = array.compact(map.modes.map(m => m.char))[0];
let char = Ary.compact(map.modes.map(m => m.char))[0];
return char === "n" ? map.name : char ? char + "_" + map.name : "";
},
headings: ["Command", "Mode", "Group", "Description"]

View File

@@ -198,12 +198,12 @@ var Marks = Module("marks", {
this._pendingJumps.push(mark);
let sh = tab.linkedBrowser.sessionHistory;
let items = array(util.range(0, sh.count));
let items = Ary(util.range(0, sh.count));
let a = items.slice(0, sh.index).reverse();
let b = items.slice(sh.index);
a.length = b.length = Math.max(a.length, b.length);
items = array(a).zip(b).flatten().compact();
items = Ary(a).zip(b).flatten().compact();
for (let i of items.iterValues()) {
let entry = sh.getEntryAtIndex(i, false);

View File

@@ -194,7 +194,7 @@ var Modes = Module("modes", {
NONE: 0,
"@@iterator": function __iterator__() array.iterValues(this.all),
"@@iterator": function __iterator__() Ary.iterValues(this.all),
get all() this._modes.slice(),
@@ -238,7 +238,7 @@ var Modes = Module("modes", {
dumpStack: function dumpStack() {
util.dump("Mode stack:");
for (let [i, mode] of array.iterItems(this._modeStack))
for (let [i, mode] of Ary.iterItems(this._modeStack))
util.dump(" " + i + ": " + mode);
},
@@ -285,7 +285,7 @@ var Modes = Module("modes", {
save: function save(id, obj, prop, test) {
if (!(id in this.boundProperties))
for (let elem of array.iterValues(this._modeStack))
for (let elem of Ary.iterValues(this._modeStack))
elem.saved[id] = { obj: obj, prop: prop, value: obj[prop], test: test };
this.boundProperties[id] = { obj: util.weakReference(obj), prop: prop, test: test };
},
@@ -447,7 +447,7 @@ var Modes = Module("modes", {
let seen = new RealSet,
res = [],
queue = [this].concat(this.bases);
for (let mode of array.iterValues(queue))
for (let mode of queue)
if (!seen.add(mode)) {
res.push(mode);
apply(queue, "push", mode.bases);
@@ -633,7 +633,7 @@ var Modes = Module("modes", {
validator: function validator(vals) vals.map(v => v.replace(/^!/, ""))
.every(k => hasOwnProperty(this.values, k)),
get values() array.toObject([[m.name.toLowerCase(), m.description]
get values() Ary.toObject([[m.name.toLowerCase(), m.description]
for (m of values(modes._modes)) if (!m.hidden)])
};

View File

@@ -201,7 +201,7 @@ var MOW = Module("mow", {
selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
};
for (let node of array.iterValues(menu.children)) {
for (let node of menu.children) {
let group = node.getAttributeNS(NS, "group");
node.hidden = group && !group.split(/\s+/).every(g => enabled[g]);
}

View File

@@ -346,7 +346,7 @@ var AddonList = Class("AddonList", {
var Addons = Module("addons", {
errors: Class.Memoize(() =>
array(["ERROR_NETWORK_FAILURE", "ERROR_INCORRECT_HASH",
Ary(["ERROR_NETWORK_FAILURE", "ERROR_INCORRECT_HASH",
"ERROR_CORRUPT_FILE", "ERROR_FILE_ACCESS"])
.map(e => [AddonManager[e], _("AddonManager." + e)])
.toObject())
@@ -466,7 +466,7 @@ var Addons = Module("addons", {
context.incomplete = true;
AddonManager.getAllAddons(function (addons) {
context.incomplete = false;
update(array.uniq(base.concat(addons.map(a => a.type)),
update(Ary.uniq(base.concat(addons.map(a => a.type)),
true));
});
}

View File

@@ -176,6 +176,7 @@ function require_(obj, name, from, targetName) {
defineModule("base", {
// sed -n 's/^(const|var|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt
exports: [
"Ary",
"Cc",
"Ci",
"Class",
@@ -269,7 +270,7 @@ function literal(comment) {
function apply(obj, meth, args) {
// The function's own apply method breaks in strange ways
// when using CPOWs.
return Function.prototype.apply.call(obj[meth], obj, args);
return Function.apply.call(obj[meth], obj, args);
}
/**
@@ -320,7 +321,8 @@ function* properties(obj, prototypes) {
}
return false;
};
return array.uniq([k for (k in obj)].concat(
return Ary.uniq([k for (k in obj)].concat(
Object.getOwnPropertyNames(
XPCNativeWrapper.unwrap(obj))
.filter(filter)));
@@ -880,7 +882,7 @@ function Class(...args) {
Class.extend(Constructor, superclass, args[0]);
memoize(Constructor, "bound", Class.makeClosure);
if (Iter && array) // Hack. :/
if (Iter && Ary) // Hack. :/
Object.defineProperty(Constructor, "closure",
deprecated("bound", { get: function closure() this.bound }));
update(Constructor, args[1]);
@@ -987,7 +989,10 @@ Class.Memoize = function Memoize(getter, wait)
return Class.replaceProperty(obj, key, getter.call(this, key));
}
catch (e) {
if (loaded.util)
util.reportError(e);
else
defineModule.dump(" " + (e.filename || e.fileName) + ":" + e.lineNumber + ": " + e + "\n" + (e.stack || Error().stack) + "\n");
}
};
@@ -1343,7 +1348,7 @@ function Struct(...args) {
const Struct = Class(className || "Struct", StructBase, {
length: args.length,
members: array.toObject(args.map((v, k) => [v, k]))
members: Ary(args).map((v, k) => [v, k]).toObject(),
});
args.forEach(function (name, i) {
Struct.prototype.__defineGetter__(name, function () this[i]);
@@ -1539,12 +1544,12 @@ function iter(obj, iface) {
else if (Symbol.iterator in obj)
res = obj[Symbol.iterator]();
else if (isinstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList]))
res = array.iterItems(obj);
res = Ary.iterItems(obj);
else if (ctypes && ctypes.CData && obj instanceof ctypes.CData) {
while (obj.constructor instanceof ctypes.PointerType)
obj = obj.contents;
if (obj.constructor instanceof ctypes.ArrayType)
res = array.iterItems(obj);
res = Ary.iterItems(obj);
else if (obj.constructor instanceof ctypes.StructType)
res = (function* () {
for (let prop of values(obj.constructor.fields)) {
@@ -1591,9 +1596,9 @@ function iter(obj, iface) {
return Iter(res);
}
update(iter, {
toArray: function toArray(iter) array(iter).array,
toArray: function toArray(iter) Ary(iter).array,
// See array.prototype for API docs.
// See Ary.prototype for API docs.
toObject: function toObject(iter) {
let obj = {};
for (let [k, v] of iter)
@@ -1688,8 +1693,7 @@ update(iter, {
return undefined;
},
sort: function sort(iter, fn, self)
array(this.toArray(iter).sort(fn, self)),
sort: function sort(iter, fn, self) Ary(iter).sort(fn, self),
uniq: function* uniq(iter) {
let seen = new RealSet;
@@ -1749,8 +1753,9 @@ function arrayWrap(fn) {
function wrapper() {
let res = fn.apply(this, arguments);
if (isArray(res))
return array(res);
if (isinstance(res, ["Iterator", "Generator"]))
return Ary(res);
if (isObject(res) && Symbol.iterator in res)
return iter(res);
return res;
}
@@ -1761,32 +1766,30 @@ function arrayWrap(fn) {
/**
* Array utility methods.
*/
var array = Class("array", Array, {
var Ary = Class("Ary", Array, {
init: function (ary) {
if (Symbol.iterator in ary)
if (Symbol.iterator in ary && !isArray(ary))
ary = [k for (k of ary)];
else if (isinstance(ary, ["Iterator", "Generator"]) || Symbol.iterator in ary)
ary = [k for (k of ary)];
else if (ary.length)
ary = Array.slice(ary);
let self = this;
return new Proxy(ary, {
get: function array_get(target, prop) {
if (prop in array && callable(array[prop]))
return arrayWrap(array[prop].bind(array, target));
if (prop == "array")
return target;
let p = target[prop];
if (!/^\d+$/.test(prop) &&
prop != "toString" &&
prop != "toSource" &&
callable(p))
return arrayWrap(p);
if (prop in Ary && callable(Ary[prop]))
return arrayWrap(Ary[prop].bind(Ary, target));
let p = target[prop];
if (typeof prop == "symbol" ||
/^\d+$/.test(prop) ||
prop == "toString" ||
prop == "toSource" ||
!callable(p))
return p;
return arrayWrap(p);
}
});
}
@@ -1922,20 +1925,27 @@ let iterProto = Iter.prototype;
Object.keys(iter).forEach(function (k) {
iterProto[k] = function (...args) {
let res = apply(iter, k, [this].concat(args));
if (isinstance(res, ["Iterator", "Generator"]))
return Iter(res);
if (k == "toArray")
return res;
if (isObject(res) && Symbol.iterator in res)
return Iter(res[Symbol.iterator]());
return res;
};
});
Object.keys(array).forEach(function (k) {
Object.keys(Ary).forEach(function (k) {
if (!(k in iterProto))
iterProto[k] = function (...args) {
let res = apply(array, k, [this.toArray()].concat(args));
if (isinstance(res, ["Iterator", "Generator"]))
return Iter(res);
let res = apply(Ary, k, [this.toArray()].concat(args));
if (isArray(res))
return array(res);
return Ary(res);
if (isObject(res) && Symbol.iterator in res)
return Iter(res[Symbol.iterator]());
return res;
};
});
@@ -1943,10 +1953,12 @@ Object.keys(array).forEach(function (k) {
Object.getOwnPropertyNames(Array.prototype).forEach(function (k) {
if (!(k in iterProto) && callable(Array.prototype[k]))
iterProto[k] = function () {
let ary = iter(this).toArray();
let ary = this.toArray();
let res = apply(ary, k, arguments);
if (isArray(res))
return array(res);
return Ary(res);
return res;
};
});
@@ -1954,6 +1966,13 @@ Object.getOwnPropertyNames(Array.prototype).forEach(function (k) {
Object.defineProperty(Class.prototype, "closure",
deprecated("bound", { get: function closure() this.bound }));
if (false)
var array = Class("array", Ary, {
init: deprecated("Ary", function init() { init.superapply(arguments) })
});
else
array = Ary;
endModule();
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}

View File

@@ -87,7 +87,7 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
bookmarks: Class.Memoize(function () this.load()),
keywords: Class.Memoize(function () array.toObject([[b.keyword, b]
keywords: Class.Memoize(function () Ary.toObject([[b.keyword, b]
for (b of this)
if (b.keyword)])),

View File

@@ -61,7 +61,7 @@ var Buffer = Module("Buffer", {
* buffer. Only returns style sheets for the 'screen' media type.
*/
get alternateStyleSheets() {
let stylesheets = array.flatten(
let stylesheets = Ary.flatten(
this.allFrames().map(w => Array.slice(w.document.styleSheets)));
return stylesheets.filter(
@@ -985,7 +985,7 @@ var Buffer = Module("Buffer", {
if (win.scrollMaxX > 0 || win.scrollMaxY > 0)
return win;
for (let frame of array.iterValues(win.frames))
for (let frame of Ary.iterValues(win.frames))
if (frame.scrollMaxX > 0 || frame.scrollMaxY > 0)
return frame;
@@ -2304,7 +2304,7 @@ var Buffer = Module("Buffer", {
let frames = buffer.allFrames(null, true);
let elements = array.flatten(frames.map(win => [m for (m of DOM.XPath(xpath, win.document))]))
let elements = Ary.flatten(frames.map(win => [m for (m of DOM.XPath(xpath, win.document))]))
.filter(function (elem) {
if (isinstance(elem, [Ci.nsIDOMHTMLFrameElement,
Ci.nsIDOMHTMLIFrameElement]))
@@ -2767,7 +2767,7 @@ Buffer.addPageInfoSection("s", "Security", function* (verbose) {
return; // For now
// Modified from Firefox
function location(data) array.compact([
function location(data) Ary.compact([
data.city, data.state, data.country
]).join(", ");

View File

@@ -220,7 +220,7 @@ var Command = Class("Command", {
parsedSpecs: Class.Memoize(function () Command.parseSpecs(this.specs)),
/** @property {[string]} All of this command's short names, e.g., "com" */
shortNames: Class.Memoize(function () array.compact(this.parsedSpecs.map(n => n[1]))),
shortNames: Class.Memoize(function () Ary.compact(this.parsedSpecs.map(n => n[1]))),
/**
* @property {[string]} All of this command's long names, e.g., "command"
@@ -231,7 +231,7 @@ var Command = Class("Command", {
name: Class.Memoize(function () this.longNames[0]),
/** @property {[string]} All of this command's long and short names. */
names: Class.Memoize(function () this.names = array.flatten(this.parsedSpecs)),
names: Class.Memoize(function () this.names = Ary.flatten(this.parsedSpecs)),
/** @property {string} This command's description, as shown in :listcommands */
description: Messages.Localized(""),
@@ -307,7 +307,7 @@ var Command = Class("Command", {
}, this)),
_options: [],
optionMap: Class.Memoize(function () array(this.options)
optionMap: Class.Memoize(function () Ary(this.options)
.map(opt => opt.names.map(name => [name, opt]))
.flatten().toObject()),
@@ -455,7 +455,7 @@ var Ex = Module("Ex", {
Class.replaceProperty(res, opt.names[0], val);
res.explicitOpts[opt.names[0]] = val;
}
for (let [i, val] of array.iterItems(args))
for (let [i, val] of Ary.iterItems(args))
res[i] = String(val);
return res;
},
@@ -535,7 +535,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
if (this.cached)
this.modules.initDependencies("commands");
this.cached = false;
return array.iterValues(this._list.sort((a, b) => a.name > b.name));
return Ary.iterValues(this._list.sort((a, b) => a.name > b.name));
},
/** @property {string} The last executed Ex command line. */
@@ -565,7 +565,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
extra.hive = this;
extra.parsedSpecs = Command.parseSpecs(specs);
let names = array.flatten(extra.parsedSpecs);
let names = Ary.flatten(extra.parsedSpecs);
let name = names[0];
if (this.name != "builtin") {
@@ -855,7 +855,7 @@ var Commands = Module("commands", {
let defaults = {};
if (args.ignoreDefaults)
defaults = array(this.options).map(opt => [opt.names[0], opt.default])
defaults = Ary(this.options).map(opt => [opt.names[0], opt.default])
.toObject();
for (let [opt, val] of iter(args.options || {})) {
@@ -1675,7 +1675,7 @@ var Commands = Module("commands", {
],
literal: 1,
serialize: function () array(commands.userHives)
serialize: function () Ary(commands.userHives)
.filter(h => h.persist)
.map(hive => [
{

View File

@@ -237,7 +237,7 @@ var CompletionContext = Class("CompletionContext", {
try {
let allItems = this.contextList.map(function m(context) context.hasItems && context.items.length);
if (this.cache.allItems && array.equals(this.cache.allItems, allItems))
if (this.cache.allItems && Ary.equals(this.cache.allItems, allItems))
return this.cache.allItemsResult;
this.cache.allItems = allItems;
@@ -250,7 +250,7 @@ var CompletionContext = Class("CompletionContext", {
get longestSubstring() self.longestAllSubstring,
get items() array.flatten(self.activeContexts.map(function m(context) {
get items() Ary.flatten(self.activeContexts.map(function m(context) {
let prefix = self.value.substring(minStart, context.offset);
return context.items.map(function m(item) ({
@@ -285,7 +285,7 @@ var CompletionContext = Class("CompletionContext", {
lists.pop());
if (!substrings) // FIXME: How is this undefined?
return [];
return array.uniq(Array.slice(substrings));
return Ary.uniq(Array.slice(substrings));
},
// Temporary
get longestAllSubstring() {

View File

@@ -227,7 +227,7 @@ var ConfigBase = Class("ConfigBase", {
.toArray();
}
else {
res = array(f.leafName
res = Ary(f.leafName
// Fails on FF3: for (f of util.getFile(uri).iterDirectory())
for (f of util.getFile(uri).readDirectory())
if (f.isDirectory())).array;
@@ -235,7 +235,7 @@ var ConfigBase = Class("ConfigBase", {
let exists = function exists(pkg) services["resource:"].hasSubstitution("dactyl-locale-" + pkg);
return array.uniq([this.appLocale, this.appLocale.replace(/-.*/, "")]
return Ary.uniq([this.appLocale, this.appLocale.replace(/-.*/, "")]
.filter(exists)
.concat(res));
}),

View File

@@ -182,7 +182,7 @@ var Contexts = Module("contexts", {
return {
enumerable: true,
get: () => array(contexts.groups[this.name])
get: () => Ary(contexts.groups[this.name])
};
this.Hive = constructor;

View File

@@ -99,8 +99,8 @@ var DOM = Class("DOM", {
get document() this._document || this[0] && (this[0].ownerDocument || this[0].document || this[0]),
set document(val) this._document = val,
attrHooks: array.toObject([
["", {
attrHooks: {
"": {
href: { get: elem => elem.href || elem.getAttribute("href") },
src: { get: elem => elem.src || elem.getAttribute("src") },
checked: { get: elem => elem.hasAttribute("checked") ? elem.getAttribute("checked") == "true" : elem.checked,
@@ -109,8 +109,8 @@ var DOM = Class("DOM", {
disabled: BooleanAttribute("disabled"),
hidden: BooleanAttribute("hidden"),
readonly: BooleanAttribute("readonly")
}]
]),
}
},
matcher: function matcher(sel) elem => (elem.mozMatchesSelector && elem.mozMatchesSelector(sel)),
@@ -309,7 +309,7 @@ var DOM = Class("DOM", {
},
set list(val) {
let str = array.uniq(val).join(" ").trim();
let str = Ary.uniq(val).join(" ").trim();
self.attrNS(NS, "highlight", str || null);
},
@@ -457,7 +457,9 @@ var DOM = Class("DOM", {
try {
var res = node.ownerDocument.defaultView.getComputedStyle(node, null);
}
catch (e) {}
catch (e) {
util.reportError(e);
}
if (res == null) {
util.dumpStack(_("error.nullComputedStyle", node));
@@ -615,7 +617,7 @@ var DOM = Class("DOM", {
else {
let tag = "<" + [namespaced(elem)].concat(
[namespaced(a) + '="' + String.replace(a.value, /["<]/, DOM.escapeHTML) + '"'
for ([i, a] of array.iterItems(elem.attributes))]).join(" ");
for (a of elem.attributes)]).join(" ");
res.push(tag + (!hasChildren ? "/>" : ">...</" + namespaced(elem) + ">"));
}
@@ -634,7 +636,7 @@ var DOM = Class("DOM", {
attrNS: function attrNS(ns, key, val) {
if (val !== undefined)
key = array.toObject([[key, val]]);
key = Ary.toObject([[key, val]]);
let hooks = this.attrHooks[ns] || {};
@@ -667,7 +669,7 @@ var DOM = Class("DOM", {
css: update(function css(key, val) {
if (val !== undefined)
key = array.toObject([[key, val]]);
key = Ary.toObject([[key, val]]);
if (isObject(key))
return this.each(function (elem) {
@@ -830,7 +832,7 @@ var DOM = Class("DOM", {
if (isObject(event))
capture = listener;
else
event = array.toObject([[event, listener]]);
event = Ary.toObject([[event, listener]]);
for (let [evt, callback] of iter(event))
event[evt] = util.wrapCallback(callback, true);
@@ -844,7 +846,7 @@ var DOM = Class("DOM", {
if (isObject(event))
capture = listener;
else
event = array.toObject([[event, listener]]);
event = Ary.toObject([[event, listener]]);
return this.each(function (elem) {
for (let [k, v] of iter(event))
@@ -855,7 +857,7 @@ var DOM = Class("DOM", {
if (isObject(event))
capture = listener;
else
event = array.toObject([[event, listener]]);
event = Ary.toObject([[event, listener]]);
for (let pair of iter(event)) {
let [evt, callback] = pair;
@@ -1146,7 +1148,7 @@ var DOM = Class("DOM", {
*/
parse: function parse(input, unknownOk=true) {
if (isArray(input))
return array.flatten(input.map(k => this.parse(k, unknownOk)));
return Ary.flatten(input.map(k => this.parse(k, unknownOk)));
let out = [];
for (let match of util.regexp.iterate(/<.*?>?>|[^<]|<(?!.*>)/g, input)) {
@@ -1871,7 +1873,7 @@ var DOM = Class("DOM", {
* @returns {string}
*/
makeXPath: function makeXPath(nodes) {
return array(nodes).map(util.debrace).flatten()
return Ary(nodes).map(util.debrace).flatten()
.map(node => /^[a-z]+:/.test(node) ? node
: [node, "xhtml:" + node])
.flatten()

View File

@@ -522,7 +522,7 @@ var RangeFind = Class("RangeFind", {
this.regexp = false;
if (regexp) {
let re = RegExp(word, "gm" + this.flags);
for (this.range of array.iterValues(this.ranges)) {
for (this.range of this.ranges) {
for (let match of util.regexp.iterate(re, DOM.stringify(this.range.range, true))) {
let lastRange = this.lastRange;
if (res = this.find(null, this.reverse, true))
@@ -575,7 +575,7 @@ var RangeFind = Class("RangeFind", {
let pageStart = RangeFind.endpoint(pageRange, true);
let pageEnd = RangeFind.endpoint(pageRange, false);
for (let frame of array.iterValues(win.frames)) {
for (let frame of Ary.iterValues(win.frames)) {
let range = doc.createRange();
if (DOM(frame.frameElement).style.visibility == "visible") {
range.selectNode(frame.frameElement);
@@ -706,11 +706,11 @@ var RangeFind = Class("RangeFind", {
set stale(val) this._stale = val,
addListeners: function addListeners() {
for (let range of array.iterValues(this.ranges))
for (let range of this.ranges)
range.window.addEventListener("unload", this.bound.onUnload, true);
},
purgeListeners: function purgeListeners() {
for (let range of array.iterValues(this.ranges))
for (let range of this.ranges)
try {
range.window.removeEventListener("unload", this.bound.onUnload, true);
}

View File

@@ -31,7 +31,7 @@ var HelpBuilder = Class("HelpBuilder", {
[f.value for (f of DOM.XPath("//dactyl:include/@href", doc))]);
// Scrape the tags from the rest of the help files.
array.flatten(files).forEach(function (file) {
Ary.flatten(files).forEach(function (file) {
this.tags[file + ".xml"] = file;
this.findHelpFile(file).forEach(function (doc) {
this.addTags(file, doc);
@@ -128,7 +128,7 @@ var Help = Module("Help", {
let betas = util.regexp(/\[((?:b|rc)\d)\]/, "gx");
let beta = array(betas.iterate(NEWS))
let beta = Ary(betas.iterate(NEWS))
.map(m => m[1]).uniq().slice(-1)[0];
function rec(text, level, li) {
@@ -151,7 +151,7 @@ var Help = Module("Help", {
else if (match.par) {
let [, par, tags] = /([^]*?)\s*((?:\[[^\]]+\])*)\n*$/.exec(match.par);
let t = tags;
tags = array(betas.iterate(tags)).map(m => m[1]);
tags = Ary(betas.iterate(tags)).map(m => m[1]);
let group = !tags.length ? "" :
!tags.some(t => t == beta) ? "HelpNewsOld" : "HelpNewsNew";
@@ -317,7 +317,7 @@ var Help = Module("Help", {
data.push(" xmlns=" + JSON.stringify(XHTML),
" xmlns:dactyl=" + JSON.stringify(NS));
for (let { name, value } of array.iterValues(node.attributes)) {
for (let { name, value } of node.attributes) {
if (name == "dactyl:highlight") {
styles.add(value);
name = "class";

View File

@@ -65,7 +65,7 @@ Highlight.defaultValue("value", function () this.defaultValue);
update(Highlight.prototype, {
get base() this.baseClass != this.class && highlight.highlight[this.baseClass] || null,
get bases() array.compact(this.extends.map(name => highlight.get(name))),
get bases() Ary.compact(this.extends.map(name => highlight.get(name))),
get inheritedCSS() {
if (this.gettingCSS)
@@ -178,7 +178,7 @@ var Highlights = Module("Highlight", {
}
highlight.set("value", newStyle || "");
highlight.extends = array.uniq(bases, true);
highlight.extends = Ary.uniq(bases, true);
if (force)
highlight.style.enabled = true;
this.highlight[highlight.class] = highlight;
@@ -432,7 +432,7 @@ var Highlights = Module("Highlight", {
context.keys = { text: f => f.leafName.replace(extRe, ""),
description: ".parent.path" };
context.completions =
array.flatten(
Ary.flatten(
io.getRuntimeDirectories("colors").map(
dir => dir.readDirectory()
.filter(file => extRe.test(file.leafName))))

View File

@@ -573,7 +573,7 @@ var IO = Module("io", {
* otherwise, the return value of *func*.
*/
withTempFiles: function withTempFiles(func, self, checked, ext, label) {
let args = array(util.range(0, func.length))
let args = Ary(util.range(0, func.length))
.map(bind("createTempFile", this, ext, label)).array;
try {
if (!args.every(util.identity))
@@ -665,7 +665,7 @@ var IO = Module("io", {
for (cmd of commands.iterator())
if (cmd.serialize)];
lines = array.flatten(lines);
lines = Ary.flatten(lines);
lines.unshift('"' + config.version + "\n");
lines.push("\n\" vim: set ft=" + config.name + ":");
@@ -857,11 +857,11 @@ unlet s:cpo_save
autocommands: wrap("syn keyword " + config.name + "AutoEvent ",
keys(config.autocommands)),
commands: wrap("syn keyword " + config.name + "Command ",
array(c.specs for (c of commands.iterator())).flatten()),
Ary(c.specs for (c of commands.iterator())).flatten()),
options: wrap("syn keyword " + config.name + "Option ",
array(o.names for (o of options) if (o.type != "boolean")).flatten()),
Ary(o.names for (o of options) if (o.type != "boolean")).flatten()),
toggleoptions: wrap("let s:toggleOptions = [",
array(o.realNames for (o of options) if (o.type == "boolean"))
Ary(o.realNames for (o of options) if (o.type == "boolean"))
.flatten().map(String.quote),
", ") + "]"
}; //}}}
@@ -1063,7 +1063,7 @@ unlet s:cpo_save
if (file.isFile() && file.isExecutable())]);
}
return array.flatten(commands);
return Ary.flatten(commands);
};
};

View File

@@ -106,7 +106,7 @@ var JavaScript = Module("javascript", {
let completions = [k for (k of this.iter(obj, toplevel))];
if (obj === this.modules) // Hack.
completions = array.uniq(completions.concat([k for (k of this.iter(this.modules.jsmodules, toplevel))]));
completions = Ary.uniq(completions.concat([k for (k of this.iter(this.modules.jsmodules, toplevel))]));
return completions;
},
@@ -623,7 +623,7 @@ var JavaScript = Module("javascript", {
* enumerable by any standard method.
*/
globalNames: Class.Memoize(function () {
return array.uniq([
return Ary.uniq([
"Array", "ArrayBuffer", "AttributeName", "Audio", "Boolean", "Components",
"CSSFontFaceStyleDecl", "CSSGroupRuleRuleList", "CSSNameSpaceRule",
"CSSRGBColor", "CSSRect", "ComputedCSSStyleDeclaration", "Date", "Error",

View File

@@ -168,7 +168,7 @@ var Modules = function Modules(window) {
newContext: newContext,
get ownPropertyValues() array.compact(
get ownPropertyValues() Ary.compact(
Object.getOwnPropertyNames(this)
.map(name => Object.getOwnPropertyDescriptor(this, name).value)),

View File

@@ -39,7 +39,7 @@ var Messages = Module("messages", {
},
bundles: Class.Memoize(function ()
array.uniq([JSMLoader.getTarget("dactyl://locale/" + this.name + ".properties"),
Ary.uniq([JSMLoader.getTarget("dactyl://locale/" + this.name + ".properties"),
JSMLoader.getTarget("dactyl://locale-local/" + this.name + ".properties"),
"resource://dactyl-locale/en-US/" + this.name + ".properties",
"resource://dactyl-locale-local/en-US/" + this.name + ".properties"],
@@ -113,7 +113,7 @@ var Messages = Module("messages", {
yield key(prop) + " = " + obj[prop];
if (iter_.values) {
let iter_ = isArray(obj.values) ? array.iterValues(obj.values)
let iter_ = isArray(obj.values) ? obj.values
: iter(obj.values);
for (let [k, v] of iter_)
@@ -130,7 +130,7 @@ var Messages = Module("messages", {
}()).toArray();
file.write(
array(commands.allHives.map(h => properties("command", h)))
Ary(commands.allHives.map(h => properties("command", h)))
.concat(modes.all.map(m =>
properties("map", values(mappings.builtin.getStack(m)
.filter(map => map.modes[0] == m)))))

View File

@@ -500,7 +500,7 @@ var Option = Class("Option", {
},
domains: {
sitelist: function (vals) array.compact(vals.map(site => util.getHost(site.filter))),
sitelist: function (vals) Ary.compact(vals.map(site => util.getHost(site.filter))),
get sitemap() this.sitelist
},
@@ -543,7 +543,7 @@ var Option = Class("Option", {
return value.map(Option.parseSite, this);
},
stringmap: function stringmap(value) array.toObject(
stringmap: function stringmap(value) Ary.toObject(
Option.splitList(value, true).map(function (v) {
let [count, key, quote] = Commands.parseArg(v, /:/);
return [key, Option.dequote(v.substr(count + 1))];
@@ -555,7 +555,7 @@ var Option = Class("Option", {
list: function list(value, parse) {
let prev = null;
return array.compact(Option.splitList(value, true)
return Ary.compact(Option.splitList(value, true)
.map(function (v) {
let [count, filter, quote] = Commands.parseArg(v, /:/, true);
@@ -810,7 +810,7 @@ var Option = Class("Option", {
update(BooleanOption.prototype, {
names: Class.Memoize(function ()
array.flatten([[name, "no" + name] for (name of values(this.realNames))]))
Ary.flatten([[name, "no" + name] for (name of values(this.realNames))]))
});
var OptionHive = Class("OptionHive", Contexts.Hive, {
@@ -1415,7 +1415,7 @@ var Options = Module("options", {
update({
bang: true,
completer: setCompleter,
domains: function domains(args) array.flatten(args.map(function (spec) {
domains: function domains(args) Ary.flatten(args.map(function (spec) {
try {
let opt = modules.options.parseOpt(spec);
if (opt.option && opt.option.domains)

View File

@@ -71,7 +71,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
let listeners = this.getData(doc, "listeners");
if (!isObject(event))
var [self, events] = [null, array.toObject([[event, callback]])];
var [self, events] = [null, Ary.toObject([[event, callback]])];
else
[self, events] = [event, event[callback || "events"]];
@@ -309,7 +309,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
if (!(node instanceof Ci.nsIDOMDocumentFragment))
savedElems.push(node);
else
for (let n of array.iterValues(node.childNodes))
for (let n of node.childNodes)
savedElems.push(n);
fn(elem, node);

View File

@@ -871,24 +871,6 @@ var AsyncFile = Class("AsyncFile", File, {
yield OS.File.makeDir(path, options);
}),
/**
* Iterates over the objects in this directory.
*/
iterDirectory: function* iterDirectory() {
if (!this.exists())
throw Error(_("io.noSuchFile"));
if (!this.isDirectory())
throw Error(_("io.eNotDir"));
for (let file of iter(this.directoryEntries))
yield File(file);
},
/**
* Returns an iterator for all lines in a file.
*/
get lines() File.readLines(services.FileInStream(this.file, -1, 0, 0),
this.charset),
_setEncoding: function _setEncoding(options) {
if (this.encoding != null && !("encoding" in options))
options = update({}, options,

View File

@@ -119,7 +119,7 @@ var Hive = Class("Hive", {
"@@iterator": function () iter(this.sheets),
get sites() array(this.sheets).map(s => s.sites)
get sites() Ary(this.sheets).map(s => s.sites)
.flatten()
.uniq().array,
@@ -411,7 +411,7 @@ var Styles = Module("Styles", {
context.keys.text = util.identity;
context.keys.description = function (site) this.sheets.length + /*L*/" sheet" + (this.sheets.length == 1 ? "" : "s") + ": " +
array.compact(this.sheets.map(s => s.name)).join(", ");
Ary.compact(this.sheets.map(s => s.name)).join(", ");
context.keys.sheets = site => group.sheets.filter(s => s.sites.indexOf(site) >= 0);
context.keys.active = site => uris.some(Styles.matchFilter(site));
@@ -596,7 +596,7 @@ var Styles = Module("Styles", {
if (args["-append"]) {
let sheet = args["-group"].get(args["-name"]);
if (sheet) {
filter = array(sheet.sites).concat(filter).uniq().join(",");
filter = Ary(sheet.sites).concat(filter).uniq().join(",");
css = sheet.css + " " + css;
}
}
@@ -633,7 +633,7 @@ var Styles = Module("Styles", {
{ names: ["-nopersist", "-N"], description: "Do not save this style to an auto-generated RC file" }
],
serialize: function ()
array(styles.hives)
Ary(styles.hives)
.filter(hive => hive.persist)
.map(hive =>
hive.sheets.filter(style => style.persist)

View File

@@ -154,7 +154,7 @@ var Template = Module("Template", {
map: function map(iter_, func, sep, interruptable) {
if (typeof iter_.length == "number") // FIXME: Kludge?
iter_ = array.iterValues(iter_);
iter_ = Ary.iterValues(iter_);
let res = [];
let n = 0;

View File

@@ -65,7 +65,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
Magic: Magic,
init: function init() {
this.Array = array;
this.Array = Ary;
this.addObserver(this);
this.windows = [];
@@ -301,7 +301,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
: "",
{ test: function test(obj) obj[char] != null }));
for (let elem of array.iterValues(stack))
for (let elem of stack)
elem.seen[char] = true;
}
}
@@ -420,7 +420,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}));
}
for (let elem of array.iterValues(stack))
for (let elem of stack)
elem.seen.add(name);
}
}
@@ -508,7 +508,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
let rec = function rec(acc) {
if (acc.length == patterns.length)
res.push(array(substrings).zip(acc).flatten().join(""));
res.push(Ary(substrings).zip(acc).flatten().join(""));
else
for (let pattern of patterns[acc.length])
rec(acc.concat(pattern));
@@ -1400,7 +1400,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
this.errors.push([new Date, obj + "\n" + obj.stack]);
this.errors = this.errors.slice(-this.maxErrors);
this.errors.toString = function () [k + "\n" + v for ([k, v] of array.iterValues(this))].join("\n\n");
this.errors.toString = function () [k + "\n" + v for ([k, v] of this)].join("\n\n");
this.dump(String(error));
this.dump(obj);
@@ -1755,7 +1755,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}
}
}, {
Array: array
Array: Ary
});
/**