Skip to content

Commit

Permalink
Shorten internal property
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Nov 12, 2024
1 parent b4bace8 commit 9fe7d5f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/fontra/client/core/font-sources-instancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ export class FontSourcesInstancer {
this.defaultLocation = Object.fromEntries(
this.fontAxesSourceSpace.map((axis) => [axis.name, axis.defaultValue])
);
this._sourceIdentifiersByLocationString = Object.fromEntries(
this._sourceIdsByLocationString = Object.fromEntries(
Object.entries(this.fontSources).map(([sourceIdentifier, source]) => [
locationToString({ ...this.defaultLocation, ...source.location }),
sourceIdentifier,
])
);
this.defaultSourceIdentifier =
this._sourceIdentifiersByLocationString[locationToString(this.defaultLocation)];
this._sourceIdsByLocationString[locationToString(this.defaultLocation)];

this._instanceCache = new LRUCache(50);
}

getLocationIdentifierForLocation(location) {
location = { ...this.defaultLocation, ...location };
return this._sourceIdentifiersByLocationString[locationToString(location)];
return this._sourceIdsByLocationString[locationToString(location)];
}

get model() {
Expand Down Expand Up @@ -72,7 +72,7 @@ export class FontSourcesInstancer {
sourceLocation = { ...this.defaultLocation, ...sourceLocation };
const locationString = locationToString(sourceLocation);

const sourceIdentifier = this._sourceIdentifiersByLocationString[locationString];
const sourceIdentifier = this._sourceIdsByLocationString[locationString];
let sourceInstance = sourceIdentifier
? this.fontSources[sourceIdentifier]
: undefined;
Expand Down

0 comments on commit 9fe7d5f

Please sign in to comment.