Skip to content

Commit

Permalink
Make DEFAULT_LOOKUP static instead of constructing new array each tim…
Browse files Browse the repository at this point in the history
…e it is used
  • Loading branch information
mridgway committed Apr 5, 2016
1 parent c810905 commit 532a053
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ var VERSION = '1.0.2',
DEFAULT = '*',
SEPARATOR = '/',
SUBMATCH = /\$\$([\w.-_]+?)\$\$/,
SUBMATCHES = /\$\$([\w.-_]+?)\$\$/g;
SUBMATCHES = /\$\$([\w.-_]+?)\$\$/g,
DEFAULT_LOOKUP = [DEFAULT];


//---------------------------------------------------------------
Expand Down Expand Up @@ -556,9 +557,9 @@ Ycb.prototype = {
for (name in this.dimensions[pos]) {
if (this.dimensions[pos].hasOwnProperty(name)) {
if (options.useAllDimensions || (this.dimsUsed[name] && this.dimsUsed[name][context[name]])) {
chains[name] = this._dimensionHierarchies[name][context[name]] || [DEFAULT];
chains[name] = this._dimensionHierarchies[name][context[name]] || DEFAULT_LOOKUP;
} else {
chains[name] = [DEFAULT];
chains[name] = DEFAULT_LOOKUP;
}
}
}
Expand Down Expand Up @@ -609,7 +610,7 @@ Ycb.prototype = {
for (pos = 0; pos < this.dimensions.length; pos += 1) {
for (name in this.dimensions[pos]) {
if (this.dimensions[pos].hasOwnProperty(name)) {
this._dimensionHierarchies[name] = this._calculateHierarchy([DEFAULT], this.dimensions[pos][name]);
this._dimensionHierarchies[name] = this._calculateHierarchy(DEFAULT_LOOKUP, this.dimensions[pos][name]);
}
}
}
Expand Down

0 comments on commit 532a053

Please sign in to comment.