X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fcontent%2Fabbreviations.js;fp=common%2Fcontent%2Fabbreviations.js;h=7ceb5e9afe57e8a994e96982f8c48610085a6552;hb=247daf849abc85f4cfb10fa358c62c8daf8db95b;hp=f0cd06d17747011ec4441a5505354031505086cc;hpb=354a049cce8415487552ce405cce167b7071fe1f;p=dactyl.git diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index f0cd06d..7ceb5e9 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2009 by Martin Stubenschrott // Copyright (c) 2010 by anekos -// Copyright (c) 2010-2013 Kris Maglione +// Copyright (c) 2010-2014 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -105,7 +105,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, { }, /** @property {boolean} True if there are no abbreviations. */ - get empty() !values(this._store).nth(util.identity, 0), + get empty() !values(this._store).find(util.identity), /** * Adds a new abbreviation. @@ -132,7 +132,8 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, { */ get: function (mode, lhs) { let abbrevs = this._store[mode]; - return abbrevs && Set.has(abbrevs, lhs) ? abbrevs[lhs] : null; + return abbrevs && hasOwnProperty(abbrevs, lhs) ? abbrevs[lhs] + : null; }, /** @@ -232,10 +233,10 @@ var Abbreviations = Module("abbreviations", { get userHives() this.allHives.filter(h => h !== this.builtin), - get: deprecated("group.abbrevs.get", { get: function get() this.user.closure.get }), - set: deprecated("group.abbrevs.set", { get: function set() this.user.closure.set }), - remove: deprecated("group.abbrevs.remove", { get: function remove() this.user.closure.remove }), - removeAll: deprecated("group.abbrevs.clear", { get: function removeAll() this.user.closure.clear }), + get: deprecated("group.abbrevs.get", { get: function get() this.user.bound.get }), + set: deprecated("group.abbrevs.set", { get: function set() this.user.bound.set }), + remove: deprecated("group.abbrevs.remove", { get: function remove() this.user.bound.remove }), + removeAll: deprecated("group.abbrevs.clear", { get: function removeAll() this.user.bound.clear }), /** * Returns the abbreviation for the given *mode* if *text* matches the @@ -250,7 +251,7 @@ var Abbreviations = Module("abbreviations", { let match = this._match.exec(text); if (match) return this.hives.map(h => h.get(mode, match[2] || match[4] || match[6])) - .nth(util.identity, 0); + .find(util.identity); return null; }, @@ -266,7 +267,7 @@ var Abbreviations = Module("abbreviations", { let hives = (hives || this.userHives).filter(h => !h.empty); function abbrevs(hive) - hive.merged.filter(ab => (ab.inModes(modes) && ab.lhs.indexOf(lhs) == 0)); + hive.merged.filter(ab => (ab.inModes(modes) && ab.lhs.startsWith(lhs))); let list = ["table", {}, ["tr", { highlight: "Title" },