acc.push(vals);
if (acc.length == pattern.length)
- this.res.push(acc.join(""))
+ this.res.push(acc.join(""));
else
for (let val in values(vals))
this.rec(acc.concat(val));
}
res.push(pattern.substr(end));
return res.map(function (s) util.dequote(s, dequote));
- }
+ };
let patterns = [];
let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy,
else
for (let [, pattern] in Iterator(patterns[acc.length]))
rec(acc.concat(pattern));
- }
+ };
rec([]);
return res;
}
[hours, minutes] = div(minutes, 60);
[days, hours] = div(hours, 24);
if (days)
- return /*L*/days + " days " + hours + " hours"
+ return /*L*/days + " days " + hours + " hours";
if (hours)
return /*L*/hours + "h " + minutes + "m";
if (minutes)
let async = params.callback || params.onload || params.onerror;
if (async) {
- xmlhttp.addEventListener("load", function handler(event) { util.trapErrors(params.onload || params.callback, params, xmlhttp, event) }, false);
- xmlhttp.addEventListener("error", function handler(event) { util.trapErrors(params.onerror || params.callback, params, xmlhttp, event) }, false);
+ xmlhttp.addEventListener("load", function handler(event) { util.trapErrors(params.onload || params.callback, params, xmlhttp, event); }, false);
+ xmlhttp.addEventListener("error", function handler(event) { util.trapErrors(params.onerror || params.callback, params, xmlhttp, event); }, false);
}
-
if (isObject(params.params)) {
let data = [encodeURIComponent(k) + "=" + encodeURIComponent(v)
for ([k, v] in iter(params.params))];
let (viewer = docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer) {
if (viewer)
yield viewer.DOMDocument;
- }
+ };
}
}
},
}
let keyIter = object;
if ("__iterator__" in object && !callable(object.__iterator__))
- keyIter = keys(object)
+ keyIter = keys(object);
for (let i in keyIter) {
let value = Magic("<no value>");
if (data.length == 0)
res.push("[]");
else {
- res.push("[\n")
+ res.push("[\n");
for (let [i, val] in Iterator(data)) {
if (i)
res.push(",\n");
- res.push(prefix)
+ res.push(prefix);
rec(val, prefix, seen);
}
res.push("\n", level, "]");
}
}
else if (isObject(data)) {
- res.push("{\n")
+ res.push("{\n");
let i = 0;
for (let [key, val] in Iterator(data)) {
if (i++)
res.push(",\n");
- res.push(prefix, JSON.stringify(key), ": ")
+ res.push(prefix, JSON.stringify(key), ": ");
rec(val, prefix, seen);
}
if (i > 0)
- res.push("\n", level, "}")
+ res.push("\n", level, "}");
else
res[res.length - 1] = "{}";
}
* @param {function} func The function to call
* @param {object} self The 'this' object for the function.
*/
- trapErrors: function trapErrors(func, self) {
+ trapErrors: function trapErrors(func, self, ...args) {
try {
if (!callable(func))
func = self[func];
- return func.apply(self || this, Array.slice(arguments, 2));
+ return func.apply(self || this, args);
}
catch (e) {
this.reportError(e);
* @param {object} self The 'this' object of the method.
* @param ... Arguments to pass to *meth*.
*/
- withProperErrors: function withProperErrors(meth, self) {
+ withProperErrors: function withProperErrors(meth, self, ...args) {
try {
- return (callable(meth) ? meth : self[meth]).apply(self, Array.slice(arguments, withProperErrors.length));
+ return (callable(meth) ? meth : self[meth]).apply(self, args);
}
catch (e) {
throw e.stack ? e : Error(e);
Array: array
});
-
/**
* Math utility methods.
* @singleton
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: