-// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2011-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
var Messages = Module("messages", {
- init: function init(name) {
+ init: function init(name = "messages") {
let self = this;
- this.name = name || "messages";
+ this.name = name;
this._ = Class("_", String, {
init: function _(message) {
let { Buffer, commands, hints, io, mappings, modes, options, sanitizer } = overlay.activeModules;
file = io.File(file);
- function properties(base, iter_, prop) iter(function _properties() {
+ function properties(base, iter_, prop = "description") iter(function _properties() {
function key(...args) [base, obj.identifier || obj.name].concat(args).join(".").replace(/[\\:=]/g, "\\$&");
- prop = prop || "description";
for (var obj in iter_) {
if (!obj.hive || obj.hive.name !== "user") {
yield key(prop) + " = " + obj[prop];
}()).toArray();
file.write(
- array(commands.allHives.map(function (h) properties("command", h)))
- .concat(modes.all.map(function (m)
+ array(commands.allHives.map(h => properties("command", h)))
+ .concat(modes.all.map(m =>
properties("map", values(mappings.builtin.getStack(m)
- .filter(function (map) map.modes[0] == m)))))
- .concat(properties("mode", values(modes.all.filter(function (m) !m.hidden))))
+ .filter(map => map.modes[0] == m)))))
+ .concat(properties("mode", values(modes.all.filter(m => !m.hidden))))
.concat(properties("option", options))
.concat(properties("hintmode", values(hints.modes), "prompt"))
.concat(properties("pageinfo", values(Buffer.pageInfo), "title"))
});
else
iter(value).forEach(function ([k, v]) {
- memoize(value, k, function () messages.get([name, k].join("."), v));
+ memoize(value, k, () => messages.get([name, k].join("."), v));
});
}
let { JavaScript } = modules;
JavaScript.setCompleter([this._, this.get, this.format], [
- function (context) messages.iterate()
+ context => messages.iterate()
]);
JavaScript.setCompleter([this.export],