How to use the serializr.deserialize 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 mobxjs / mobx / test / base / decorate.js View on Github external
test("decorate a property with two decorators", function() {
    let updatedByAutorun

    class Obj {
        x = null
    }

    decorate(Obj, {
        x: [serializable(primitive()), observable]
    })

    const obj = deserialize(Obj, {
        x: 0
    })

    const d = autorun(() => {
        updatedByAutorun = obj.x
    })

    expect(isObservableProp(obj, "x")).toBe(true)
    expect(updatedByAutorun).toEqual(0)

    obj.x++

    expect(obj.x).toEqual(1)
    expect(updatedByAutorun).toEqual(1)
    expect(serialize(obj).x).toEqual(1)
github ksandin / darkestdungeon / src / state / AppState.ts View on Github external
load () {
    const rawProfileList = localStorage.getItem('profileList');
    if (rawProfileList) {
      try {
        const jsProfileList = JSON.parse(rawProfileList);

        const profileList = [];
        for (const jsProfile of jsProfileList) {
          const profile = deserialize(Profile, jsProfile);
          profileList.push(profile);
          this.profiles.addProfile(profile);
        }
      } catch (e) {
        console.error('Unable to parse localStorage data: ' + e);
      }
    }
  }
github nathanstitt / mobx-decorated-models / lib / class-decorator.js View on Github external
deserialize(json, callback) {
        return deserialize(getDefaultModelSchema(this), json, callback);
    },
};
github nathanstitt / mobx-decorated-models / dist / build.module.js View on Github external
deserialize: function deserialize$$1(json, callback) {
        return deserialize(getDefaultModelSchema(this), json, callback);
    }
};
github fluid-notion / fluid-outliner / core / views / models / RouteViewModel.ts View on Github external
public static instance() {
        return deserialize(RouteViewModel, parseQuery())
    }