Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 9x 9x 4x 4x 5x 5x 5x 9x 1x 1x 5x 5x 5x 5x 4x 4x 4x 4x 5x 1x 1x 1x 1x 1x 1x | import {get} from '../utils/api-json.js';
import urls from '../utils/urls.js';
import Menu from './Menu.js';
import Is from 'strong-type';
const is=new Is;
const weakIs=new Is(false);
class Store{
//parameters object required
//parameters.id also required as a minimum
constructor(id,lang='en') {
//accept both string and number types for id
if(!weakIs.number(id)&&!weakIs.string(id)){
throw new ReferenceError(`Store class expects id to be a number or string, but got ${id}`);
}
is.string(lang);
return this.#init(id,lang);
}
async #init(id,lang) {
this.info=await get(
urls.store.info.replace('${storeID}', id)
);
this.menu=await new Menu(id,lang);
return this;
}
};
export {
Store as default,
Store
}
|