How to use the serializr.map function in serializr

To help you get started, we’ve selected a few serializr 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 ksandin / darkestdungeon / src / state / types / Character.ts View on Github external
@serializable(list(object(Item)))
  @observable
  items: Item[] = [];

  @serializable @observable hunger: number = 0;

  @serializable @observable classInfoStatsScale = 1;

  @serializable @observable buffSourceName: string;

  @serializable(object(TurnStats))
  @observable
  buff: TurnStats;

  @serializable(map(object(TurnStats)))
  @observable
  dots = new Map();

  @serializable(object(Stats))
  @observable mutableStats = new Stats();

  @serializable(map(primitive()))
  @observable
  private skillLevels = new Map();

  @serializable(map(primitive()))
  @observable
  private skillSelections = new Map();

  get skills () {
    return this.classInfo.skills.map((info) => new Skill(this.skillLevels, this.skillSelections, info));
github pinqy520 / mobx-persist / lib / types.js View on Github external
function map(s) {
    return serializr_1.map(object(s));
}
exports.types = { object: object, list: list, map: map };
github ksandin / darkestdungeon / src / state / types / Stats.ts View on Github external
@serializable(StatItem.serializr())
  public speed = StatItem.declare('Spd', 'Speed');

  @serializable(StatItem.serializr())
  public accuracy = StatItem.declare('Acc', 'Accuracy');

  @serializable(StatItem.serializr())
  public criticalChance = StatItem.declare('Crt', 'Critical Hit Chance', true);

  @serializable(StatItem.serializr())
  public damage = StatItem.declare(' Dmg', ' Damage');

  @serializable(map(StatItem.serializr()))
  public resistances = declareStatuses(' Res', ' Resistance');

  @serializable(map(StatItem.serializr()))
  public statuses = declareStatuses('', ' Chance');

  @serializable(map(StatItem.serializr()))
  public statusDamageScales = declareStatuses(' Dmg', ' Damage Modifier');

  get battle () {
    return [this.dodge, this.protect, this.speed, this.accuracy, this.criticalChance, this.damage];
  }

  get base () {
    return [this.maxHealth, this.maxStress, ...this.battle];
  }

  get all () {
    return [
      this.health, this.stress,
github ksandin / darkestdungeon / src / state / types / Character.ts View on Github external
@serializable @observable classInfoStatsScale = 1;

  @serializable @observable buffSourceName: string;

  @serializable(object(TurnStats))
  @observable
  buff: TurnStats;

  @serializable(map(object(TurnStats)))
  @observable
  dots = new Map();

  @serializable(object(Stats))
  @observable mutableStats = new Stats();

  @serializable(map(primitive()))
  @observable
  private skillLevels = new Map();

  @serializable(map(primitive()))
  @observable
  private skillSelections = new Map();

  get skills () {
    return this.classInfo.skills.map((info) => new Skill(this.skillLevels, this.skillSelections, info));
  }

  get selectedSkills () {
    return this.skills.filter((skill) => skill.isSelected);
  }

  @computed get scaledClassInfo () {
github pinqy520 / mobx-persist / src / types.ts View on Github external
function map(s: any) {
    return _map(object(s))
}