mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 02:22:26 +01:00
Move util.identity to the base module.
Most other functions of its ilk live there.
This commit is contained in:
@@ -105,7 +105,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/** @property {boolean} True if there are no abbreviations. */
|
/** @property {boolean} True if there are no abbreviations. */
|
||||||
get empty() { return !values(this._store).find(util.identity); },
|
get empty() { return !values(this._store).find(identity); },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new abbreviation.
|
* Adds a new abbreviation.
|
||||||
@@ -251,7 +251,7 @@ var Abbreviations = Module("abbreviations", {
|
|||||||
let match = this._match.exec(text);
|
let match = this._match.exec(text);
|
||||||
if (match)
|
if (match)
|
||||||
return this.hives.map(h => h.get(mode, match[2] || match[4] || match[6]))
|
return this.hives.map(h => h.get(mode, match[2] || match[4] || match[6]))
|
||||||
.find(util.identity);
|
.find(identity);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
for (b of bookmarkcache)
|
for (b of bookmarkcache)
|
||||||
if (b.tags))
|
if (b.tags))
|
||||||
.flatten().uniq().array;
|
.flatten().uniq().array;
|
||||||
context.keys = { text: util.identity, description: util.identity };
|
context.keys = { text: identity, description: identity };
|
||||||
},
|
},
|
||||||
type: CommandOption.LIST
|
type: CommandOption.LIST
|
||||||
};
|
};
|
||||||
@@ -705,7 +705,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
return null;
|
return null;
|
||||||
}).filter(util.identity);
|
}).filter(identity);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -742,7 +742,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
let ctxt = context.fork(name, 0);
|
let ctxt = context.fork(name, 0);
|
||||||
|
|
||||||
ctxt.title = [/*L*/desc + " Suggestions"];
|
ctxt.title = [/*L*/desc + " Suggestions"];
|
||||||
ctxt.keys = { text: util.identity, description: function () "" };
|
ctxt.keys = { text: identity, description: function () "" };
|
||||||
ctxt.compare = CompletionContext.Sort.unsorted;
|
ctxt.compare = CompletionContext.Sort.unsorted;
|
||||||
ctxt.filterFunc = null;
|
ctxt.filterFunc = null;
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
this.elements[obj.name] = obj;
|
this.elements[obj.name] = obj;
|
||||||
|
|
||||||
function get(prefix, map, id) {
|
function get(prefix, map, id) {
|
||||||
return (obj.getElement || util.identity)(map[id] || document.getElementById(prefix + id));
|
return (obj.getElement || identity)(map[id] || document.getElementById(prefix + id));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.active.__defineGetter__(obj.name, () => this.activeGroup[obj.name][obj.name]);
|
this.active.__defineGetter__(obj.name, () => this.activeGroup[obj.name][obj.name]);
|
||||||
@@ -200,7 +200,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
else {
|
else {
|
||||||
highlight.highlightNode(elem,
|
highlight.highlightNode(elem,
|
||||||
(val[0] != null ? val[0] : obj.defaultGroup)
|
(val[0] != null ? val[0] : obj.defaultGroup)
|
||||||
.split(/\s/).filter(util.identity)
|
.split(/\s/).filter(identity)
|
||||||
.map(g => g + " " + nodeSet.group + g)
|
.map(g => g + " " + nodeSet.group + g)
|
||||||
.join(" "));
|
.join(" "));
|
||||||
elem.value = val[1];
|
elem.value = val[1];
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
{
|
{
|
||||||
argCount: "*",
|
argCount: "*",
|
||||||
completer: function (context, args) {
|
completer: function (context, args) {
|
||||||
context.keys.text = util.identity;
|
context.keys.text = identity;
|
||||||
context.keys.description = function () {
|
context.keys.description = function () {
|
||||||
return seen[this.text] + /*L*/" matching items";
|
return seen[this.text] + /*L*/" matching items";
|
||||||
};
|
};
|
||||||
@@ -662,7 +662,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
*/
|
*/
|
||||||
generateHelp: function generateHelp(obj, extraHelp, str, specOnly) {
|
generateHelp: function generateHelp(obj, extraHelp, str, specOnly) {
|
||||||
let link, tag, spec;
|
let link, tag, spec;
|
||||||
link = tag = spec = util.identity;
|
link = tag = spec = identity;
|
||||||
let args = null;
|
let args = null;
|
||||||
|
|
||||||
if (obj instanceof Command) {
|
if (obj instanceof Command) {
|
||||||
@@ -1286,7 +1286,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
template.map(iter(dactyl.indices),
|
template.map(iter(dactyl.indices),
|
||||||
([name, iter]) =>
|
([name, iter]) =>
|
||||||
["dl", { insertafter: name + "-index" },
|
["dl", { insertafter: name + "-index" },
|
||||||
template.map(iter(), util.identity)],
|
template.map(iter(), identity)],
|
||||||
"\n\n")]);
|
"\n\n")]);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
|||||||
@@ -777,7 +777,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
completion: function initCompletion() {
|
completion: function initCompletion() {
|
||||||
completion.register = function complete_register(context) {
|
completion.register = function complete_register(context) {
|
||||||
context = context.fork("registers");
|
context = context.fork("registers");
|
||||||
context.keys = { text: util.identity, description: editor.bound.getRegister };
|
context.keys = { text: identity, description: editor.bound.getRegister };
|
||||||
|
|
||||||
context.match = function (r) {
|
context.match = function (r) {
|
||||||
return !this.filter || this.filter.contains(r);
|
return !this.filter || this.filter.contains(r);
|
||||||
@@ -1413,7 +1413,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
let res = {};
|
let res = {};
|
||||||
services.spell.getDictionaryList(res, {});
|
services.spell.getDictionaryList(res, {});
|
||||||
context.completions = res.value;
|
context.completions = res.value;
|
||||||
context.keys = { text: util.identity, description: util.identity };
|
context.keys = { text: identity, description: identity };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ var History = Module("history", {
|
|||||||
completion.domain = context => {
|
completion.domain = context => {
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.compare = (a, b) => String.localeCompare(a.key, b.key);
|
context.compare = (a, b) => String.localeCompare(a.key, b.key);
|
||||||
context.keys = { text: util.identity, description: util.identity,
|
context.keys = { text: identity, description: identity,
|
||||||
key: function (host) host.split(".").reverse().join(".") };
|
key: function (host) host.split(".").reverse().join(".") };
|
||||||
|
|
||||||
// FIXME: Schema-specific
|
// FIXME: Schema-specific
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
|||||||
*/
|
*/
|
||||||
add: function (modes, keys, description, action, extra={}) {
|
add: function (modes, keys, description, action, extra={}) {
|
||||||
modes = Array.concat(modes);
|
modes = Array.concat(modes);
|
||||||
if (!modes.every(util.identity))
|
if (!modes.every(identity))
|
||||||
throw TypeError(/*L*/"Invalid modes: " + modes);
|
throw TypeError(/*L*/"Invalid modes: " + modes);
|
||||||
|
|
||||||
let map = Map(modes, keys, description, action, extra);
|
let map = Map(modes, keys, description, action, extra);
|
||||||
|
|||||||
@@ -301,14 +301,14 @@ var Marks = Module("marks", {
|
|||||||
"(" + Math.round(mark.offset.x * 100),
|
"(" + Math.round(mark.offset.x * 100),
|
||||||
Math.round(mark.offset.y * 100) + ")",
|
Math.round(mark.offset.y * 100) + ")",
|
||||||
(tab && "tab: " + tabs.index(tab))
|
(tab && "tab: " + tabs.index(tab))
|
||||||
].filter(util.identity).join(", ");
|
].filter(identity).join(", ");
|
||||||
|
|
||||||
if (mark.position)
|
if (mark.position)
|
||||||
return [name, mark.location,
|
return [name, mark.location,
|
||||||
"(" + Math.round(mark.position.x * 100) + "%",
|
"(" + Math.round(mark.position.x * 100) + "%",
|
||||||
Math.round(mark.position.y * 100) + "%)",
|
Math.round(mark.position.y * 100) + "%)",
|
||||||
(tab && "tab: " + tabs.index(tab))
|
(tab && "tab: " + tabs.index(tab))
|
||||||
].filter(util.identity).join(", ");
|
].filter(identity).join(", ");
|
||||||
},
|
},
|
||||||
|
|
||||||
isLocalMark: bind("test", /^[a-z`']$/),
|
isLocalMark: bind("test", /^[a-z`']$/),
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ defineModule("base", {
|
|||||||
"deprecated",
|
"deprecated",
|
||||||
"endModule",
|
"endModule",
|
||||||
"hasOwnProperty",
|
"hasOwnProperty",
|
||||||
|
"identity",
|
||||||
"isArray",
|
"isArray",
|
||||||
"isGenerator",
|
"isGenerator",
|
||||||
"isObject",
|
"isObject",
|
||||||
@@ -724,6 +725,14 @@ function call(fn, self, ...args) {
|
|||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns *val*.
|
||||||
|
*
|
||||||
|
* @param {*} val
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
function identity(val) { return val; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memoizes an object property value.
|
* Memoizes an object property value.
|
||||||
*
|
*
|
||||||
@@ -1632,7 +1641,7 @@ update(iter, {
|
|||||||
compact: function compact(iter) (item for (item of iter) if (item != null)),
|
compact: function compact(iter) (item for (item of iter) if (item != null)),
|
||||||
|
|
||||||
every: function every(iter, pred, self) {
|
every: function every(iter, pred, self) {
|
||||||
pred = pred || util.identity;
|
pred = pred || identity;
|
||||||
for (let elem of iter)
|
for (let elem of iter)
|
||||||
if (!pred.call(self, elem))
|
if (!pred.call(self, elem))
|
||||||
return false;
|
return false;
|
||||||
@@ -1640,7 +1649,7 @@ update(iter, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
some: function every(iter, pred, self) {
|
some: function every(iter, pred, self) {
|
||||||
pred = pred || util.identity;
|
pred = pred || identity;
|
||||||
for (let elem of iter)
|
for (let elem of iter)
|
||||||
if (pred.call(self, elem))
|
if (pred.call(self, elem))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -2552,7 +2552,7 @@ var Buffer = Module("Buffer", {
|
|||||||
res = iter.find(filter.matcher(doc),
|
res = iter.find(filter.matcher(doc),
|
||||||
elem => ((elem.nodeValue || elem.textContent).trim() == line &&
|
elem => ((elem.nodeValue || elem.textContent).trim() == line &&
|
||||||
DOM(elem).display != "none"))
|
DOM(elem).display != "none"))
|
||||||
|| iter.nth(filter.matcher(doc), util.identity, line - 1);
|
|| iter.nth(filter.matcher(doc), identity, line - 1);
|
||||||
if (res)
|
if (res)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -917,7 +917,7 @@ var Commands = Module("commands", {
|
|||||||
* @returns {Command}
|
* @returns {Command}
|
||||||
*/
|
*/
|
||||||
get: function get(name, full) iter(this.hives).map(([i, hive]) => hive.get(name, full))
|
get: function get(name, full) iter(this.hives).map(([i, hive]) => hive.get(name, full))
|
||||||
.find(util.identity),
|
.find(identity),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if a command invocation contains a URL referring to the
|
* Returns true if a command invocation contains a URL referring to the
|
||||||
@@ -1569,7 +1569,7 @@ var Commands = Module("commands", {
|
|||||||
let quote = RegExp.$2;
|
let quote = RegExp.$2;
|
||||||
context.quote = null;
|
context.quote = null;
|
||||||
context.offset -= idx;
|
context.offset -= idx;
|
||||||
context.filter = str.substr(0, idx) + (quote ? Option.quote : util.identity)(context.filter);
|
context.filter = str.substr(0, idx) + (quote ? Option.quote : identity)(context.filter);
|
||||||
|
|
||||||
context.fork("ex", 0, completion, "ex");
|
context.fork("ex", 0, completion, "ex");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
get createRow() { return this._createRow || template.completionRow; }, // XXX
|
get createRow() { return this._createRow || template.completionRow; }, // XXX
|
||||||
set createRow(createRow) { return this._createRow = createRow; },
|
set createRow(createRow) { return this._createRow = createRow; },
|
||||||
|
|
||||||
get filterFunc() { return this._filterFunc || util.identity; },
|
get filterFunc() { return this._filterFunc || identity; },
|
||||||
set filterFunc(val) { this._filterFunc = val; },
|
set filterFunc(val) { this._filterFunc = val; },
|
||||||
|
|
||||||
get filter() {
|
get filter() {
|
||||||
@@ -595,7 +595,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
if (this._substrings)
|
if (this._substrings)
|
||||||
return this._substrings;
|
return this._substrings;
|
||||||
|
|
||||||
let fixCase = this.ignoreCase ? String.toLowerCase : util.identity;
|
let fixCase = this.ignoreCase ? String.toLowerCase : identity;
|
||||||
let text = fixCase(items[0].text);
|
let text = fixCase(items[0].text);
|
||||||
let filter = fixCase(this.filter);
|
let filter = fixCase(this.filter);
|
||||||
|
|
||||||
@@ -1035,7 +1035,7 @@ var Completion = Module("completion", {
|
|||||||
if (/^jar:[^!]*$/.test(context.filter)) {
|
if (/^jar:[^!]*$/.test(context.filter)) {
|
||||||
context.advance(4);
|
context.advance(4);
|
||||||
|
|
||||||
context.quote = context.quote || ["", util.identity, ""];
|
context.quote = context.quote || ["", identity, ""];
|
||||||
let quote = context.quote[1];
|
let quote = context.quote[1];
|
||||||
context.quote[1] = function quote_1(str) {
|
context.quote[1] = function quote_1(str) {
|
||||||
return quote(str.replace(/!/g, escape));
|
return quote(str.replace(/!/g, escape));
|
||||||
@@ -1185,7 +1185,7 @@ var Completion = Module("completion", {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let re = RegExp(tokens.filter(util.identity).map(util.regexp.escape).join("|"), "g");
|
let re = RegExp(tokens.filter(identity).map(util.regexp.escape).join("|"), "g");
|
||||||
function highlight(item, text, i) {
|
function highlight(item, text, i) {
|
||||||
return process[i].call(this, item, template.highlightRegexp(text, re));
|
return process[i].call(this, item, template.highlightRegexp(text, re));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ var Contexts = Module("contexts", {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let process = util.identity;
|
let process = identity;
|
||||||
|
|
||||||
if (callable(params))
|
if (callable(params))
|
||||||
var makeParams = function makeParams(self, args) {
|
var makeParams = function makeParams(self, args) {
|
||||||
@@ -663,7 +663,7 @@ var Contexts = Module("contexts", {
|
|||||||
|
|
||||||
if (!group.builtin && args.has("-args")) {
|
if (!group.builtin && args.has("-args")) {
|
||||||
group.argsExtra = contexts.bindMacro({ literalArg: "return " + args["-args"] },
|
group.argsExtra = contexts.bindMacro({ literalArg: "return " + args["-args"] },
|
||||||
"-javascript", util.identity);
|
"-javascript", identity);
|
||||||
group.args = args["-args"];
|
group.args = args["-args"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ var DOM = Class("DOM", {
|
|||||||
res.push({}.toString.call(elem));
|
res.push({}.toString.call(elem));
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
res = template.map(res, util.identity, ",");
|
res = template.map(res, identity, ",");
|
||||||
return color ? res : res.join("");
|
return color ? res : res.join("");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ var Download = Class("Download", {
|
|||||||
let val = this._compare[order.substr(1)](this, other);
|
let val = this._compare[order.substr(1)](this, other);
|
||||||
|
|
||||||
return (order[0] == "-") ? -val : val;
|
return (order[0] == "-") ? -val : val;
|
||||||
}, this).find(util.identity) || 0,
|
}, this).find(identity) || 0,
|
||||||
|
|
||||||
timeRemaining: Infinity,
|
timeRemaining: Infinity,
|
||||||
|
|
||||||
|
|||||||
@@ -584,7 +584,7 @@ var IO = Module("io", {
|
|||||||
let args = Ary(util.range(0, func.length))
|
let args = Ary(util.range(0, func.length))
|
||||||
.map(bind("createTempFile", this, ext, label)).array;
|
.map(bind("createTempFile", this, ext, label)).array;
|
||||||
try {
|
try {
|
||||||
if (!args.every(util.identity))
|
if (!args.every(identity))
|
||||||
return false;
|
return false;
|
||||||
var res = func.apply(self || this, args);
|
var res = func.apply(self || this, args);
|
||||||
}
|
}
|
||||||
@@ -979,7 +979,7 @@ unlet s:cpo_save
|
|||||||
completion.charset = context => {
|
completion.charset = context => {
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.keys = {
|
context.keys = {
|
||||||
text: util.identity,
|
text: identity,
|
||||||
description: charset => io.charsetTitle(charset)
|
description: charset => io.charsetTitle(charset)
|
||||||
};
|
};
|
||||||
context.completions = io.charsets;
|
context.completions = io.charsets;
|
||||||
@@ -1163,7 +1163,7 @@ unlet s:cpo_save
|
|||||||
});
|
});
|
||||||
options.add(["cdpath", "cd"],
|
options.add(["cdpath", "cd"],
|
||||||
"List of directories searched when executing :cd",
|
"List of directories searched when executing :cd",
|
||||||
"stringlist", ["."].concat(services.environment.get("CDPATH").split(/[:;]/).filter(util.identity)).join(","),
|
"stringlist", ["."].concat(services.environment.get("CDPATH").split(/[:;]/).filter(identity)).join(","),
|
||||||
{
|
{
|
||||||
get files() {
|
get files() {
|
||||||
return this.value.map(path => File(path, modules.io.cwd))
|
return this.value.map(path => File(path, modules.io.cwd))
|
||||||
|
|||||||
@@ -1322,7 +1322,7 @@ var Options = Module("options", {
|
|||||||
[option.stringValue, _("option.currentValue")],
|
[option.stringValue, _("option.currentValue")],
|
||||||
[option.stringDefaultValue, _("option.defaultValue")]
|
[option.stringDefaultValue, _("option.defaultValue")]
|
||||||
].filter(f => f[0] !== "");
|
].filter(f => f[0] !== "");
|
||||||
context.quote = ["", util.identity, ""];
|
context.quote = ["", identity, ""];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
context.title = ["Domain"];
|
context.title = ["Domain"];
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.compare = modules.CompletionContext.Sort.unsorted;
|
context.compare = modules.CompletionContext.Sort.unsorted;
|
||||||
context.keys = { text: util.identity, description: util.identity };
|
context.keys = { text: identity, description: identity };
|
||||||
context.completions = res;
|
context.completions = res;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ var Hive = Class("Hive", {
|
|||||||
sheet.sites = filter;
|
sheet.sites = filter;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sheet = Sheet(name, styles._id++, filter.filter(util.identity), String(css), this, agent);
|
sheet = Sheet(name, styles._id++, filter.filter(identity), String(css), this, agent);
|
||||||
this.sheets.push(sheet);
|
this.sheets.push(sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ var Styles = Module("Styles", {
|
|||||||
|
|
||||||
context.generate = () => values(group.sites);
|
context.generate = () => values(group.sites);
|
||||||
|
|
||||||
context.keys.text = util.identity;
|
context.keys.text = identity;
|
||||||
context.keys.description = function (site) {
|
context.keys.description = function (site) {
|
||||||
return this.sheets.length + /*L*/" sheet" +
|
return this.sheets.length + /*L*/" sheet" +
|
||||||
(this.sheets.length == 1 ? "" : "s") + ": " +
|
(this.sheets.length == 1 ? "" : "s") + ": " +
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
haveGecko: deprecated("config.haveGecko", { get: function haveGecko() config.bound.haveGecko }),
|
haveGecko: deprecated("config.haveGecko", { get: function haveGecko() config.bound.haveGecko }),
|
||||||
OS: deprecated("config.OS", { get: function OS() config.OS }),
|
OS: deprecated("config.OS", { get: function OS() config.OS }),
|
||||||
|
|
||||||
|
identity: deprecated("identity", { get: function identity() global.identity }),
|
||||||
|
|
||||||
dactyl: update(function dactyl(obj) {
|
dactyl: update(function dactyl(obj) {
|
||||||
if (obj)
|
if (obj)
|
||||||
var global = Class.objectGlobal(obj);
|
var global = Class.objectGlobal(obj);
|
||||||
@@ -346,7 +348,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
return this[this.length - 1];
|
return this[this.length - 1];
|
||||||
});
|
});
|
||||||
|
|
||||||
let unknown = util.identity;
|
let unknown = identity;
|
||||||
if (!keepUnknown)
|
if (!keepUnknown)
|
||||||
unknown = () => "";
|
unknown = () => "";
|
||||||
|
|
||||||
@@ -395,7 +397,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
let [, flags, name] = /^((?:[a-z]-)*)(.*)/.exec(macro);
|
let [, flags, name] = /^((?:[a-z]-)*)(.*)/.exec(macro);
|
||||||
flags = new RealSet(flags);
|
flags = new RealSet(flags);
|
||||||
|
|
||||||
let quote = util.identity;
|
let quote = identity;
|
||||||
if (flags.has("q"))
|
if (flags.has("q"))
|
||||||
quote = function quote(obj) {
|
quote = function quote(obj) {
|
||||||
return typeof obj === "number" ? obj : JSON.stringify(obj);
|
return typeof obj === "number" ? obj : JSON.stringify(obj);
|
||||||
@@ -851,14 +853,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* The identity function.
|
|
||||||
*
|
|
||||||
* @param {Object} k
|
|
||||||
* @returns {Object}
|
|
||||||
*/
|
|
||||||
identity: function identity(k) k,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the intersection of two rectangles.
|
* Returns the intersection of two rectangles.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user