broccoli-ember-preparse
Version:
Broccoli plugin that applies some compile time performance optimizations to an ember build.
21 lines (17 loc) • 403 B
JavaScript
function NameSet() {
this.map = Object.create(null);
this.names = [];
}
NameSet.prototype.add = function add(name) {
var index = this.map[name];
if (index !== undefined) {
return index;
}
index = this.names.length;
this.map[name] = index;
this.names[index] = name;
};
NameSet.prototype.has = function has(name) {
return this.map[name] !== undefined;
}
module.exports = NameSet;