How to use the girlsfrontline-core.fairies.map function in girlsfrontline-core

To help you get started, we’ve selected a few girlsfrontline-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 36base / 36base.github.io / src / repositories / FairyRepository.js View on Github external
const { alias: { fairy: fairyAlias } } = gfextradata({ locale: 'ko' });

const buildData = fairy => Object.assign(
  fairy,
  {
    buildTime: (
      fairy.id > 1000
      || fairy.id === 18
      || fairy.id === 19
      || fairy.id === 20
    ) ? 0 : fairy.buildTime,
    alias: fairyAlias[fairy.id] || [],
  },
);

const fairyMap = new Map(fairies.map(e => [e.id, e]));

const getAll = () => {
  const fairyDict = {};

  fairyMap.forEach((e, id) => {
    fairyDict[id] = buildData(new Fairy(e.toJSON()));
  });

  return fairyDict;
};

const getNewById = (id) => {
  const fairy = fairyMap.get(id);
  if (!fairy) { return null; }

  return buildData(new Fairy(fairy.toJSON()));

girlsfrontline-core

GirlsFrontline Library

MIT
Latest version published 2 years ago

Package Health Score

49 / 100
Full package analysis

Similar packages