mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
Webready unified into a getter
This commit is contained in:
parent
e783e92029
commit
eb2081ce9e
@ -113,11 +113,12 @@ module.exports = exports = class Asset extends File {
|
||||
return this;
|
||||
}
|
||||
|
||||
webready () {
|
||||
const { type, name, sizes } = this;
|
||||
get webready () {
|
||||
const { type, name, url, sizes } = this;
|
||||
return {
|
||||
type,
|
||||
name,
|
||||
url,
|
||||
sizes: sizes.map((s) => pick(s, [ 'url', 'width', 'height' ])),
|
||||
};
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ module.exports = exports = class Files {
|
||||
find(assets, { name: 'titlecard', dir: this.base }),
|
||||
);
|
||||
|
||||
this._getWebReady = memoize(() => assets && keyBy(assets.map((a) => a.webready()), 'name'));
|
||||
this._getWebReady = memoize(() => assets && keyBy(assets.map((a) => a.webready), 'name'));
|
||||
|
||||
this.for = memoize(this.for);
|
||||
}
|
||||
@ -63,8 +63,10 @@ module.exports = exports = class Files {
|
||||
|
||||
_parsePath (filepath) {
|
||||
if (typeof filepath === 'object') return filepath;
|
||||
if (filepath.includes('#')) return false;
|
||||
const k = kind(filepath);
|
||||
const F = this.KIND_MAP[k];
|
||||
if (!F) return false;
|
||||
const f = new F(filepath);
|
||||
if (f.kind === KIND.PAGE && f.preprocessed) return false;
|
||||
return f;
|
||||
|
Loading…
x
Reference in New Issue
Block a user