|
|
|
@ -1,35 +1,23 @@
|
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
|
// Sanity-check the conversion and remove this comment.
|
|
|
|
|
/*
|
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
|
* DS206: Consider reworking classes to avoid initClass
|
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
|
|
|
|
*/
|
|
|
|
|
//= require app/searcher
|
|
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
let applyAliases = undefined;
|
|
|
|
|
app.models.Entry = class Entry extends app.Model {
|
|
|
|
|
static initClass() {
|
|
|
|
|
let ALIASES;
|
|
|
|
|
applyAliases = function (string) {
|
|
|
|
|
if (ALIASES.hasOwnProperty(string)) {
|
|
|
|
|
return [string, ALIASES[string]];
|
|
|
|
|
app.models.Entry = class Entry extends app.Model {
|
|
|
|
|
static applyAliases(string) {
|
|
|
|
|
if (Entry.ALIASES.hasOwnProperty(string)) {
|
|
|
|
|
return [string, Entry.ALIASES[string]];
|
|
|
|
|
} else {
|
|
|
|
|
const words = string.split(".");
|
|
|
|
|
for (let i = 0; i < words.length; i++) {
|
|
|
|
|
var word = words[i];
|
|
|
|
|
if (ALIASES.hasOwnProperty(word)) {
|
|
|
|
|
words[i] = ALIASES[word];
|
|
|
|
|
if (Entry.ALIASES.hasOwnProperty(word)) {
|
|
|
|
|
words[i] = Entry.ALIASES[word];
|
|
|
|
|
return [string, words.join(".")];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ALIASES = ALIASES = {
|
|
|
|
|
static ALIASES = {
|
|
|
|
|
angular: "ng",
|
|
|
|
|
"angular.js": "ng",
|
|
|
|
|
"backbone.js": "bb",
|
|
|
|
@ -64,16 +52,15 @@
|
|
|
|
|
typescript: "ts",
|
|
|
|
|
"underscore.js": "_",
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
// Attributes: name, type, path
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments);
|
|
|
|
|
this.text = applyAliases(app.Searcher.normalizeString(this.name));
|
|
|
|
|
this.text = Entry.applyAliases(app.Searcher.normalizeString(this.name));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addAlias(name) {
|
|
|
|
|
const text = applyAliases(app.Searcher.normalizeString(name));
|
|
|
|
|
const text = Entry.applyAliases(app.Searcher.normalizeString(name));
|
|
|
|
|
if (!Array.isArray(this.text)) {
|
|
|
|
|
this.text = [this.text];
|
|
|
|
|
}
|
|
|
|
@ -115,7 +102,4 @@
|
|
|
|
|
loadFile(onSuccess, onError) {
|
|
|
|
|
return app.db.load(this, onSuccess, onError);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
app.models.Entry.initClass();
|
|
|
|
|
return app.models.Entry;
|
|
|
|
|
})();
|
|
|
|
|
};
|
|
|
|
|