How to use the ember-changeset/utils/computed/transform function in ember-changeset

To help you get started, we’ve selected a few ember-changeset 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 poteto / ember-changeset / addon / index.js View on Github external
* Internal descriptor for changeset identification.
     */
    __changeset__: CHANGESET,

    changes: objectToArray(CHANGES, (c /*: Change */) => c.value, false),
    errors:  objectToArray(ERRORS, (e /*: Err */) => ({ value: e.value, validation: e.validation }), true),
    change:  inflate(CHANGES, c => c.value),
    error:   inflate(ERRORS, e => ({ value: e.value, validation: e.validation })),
    data:    readOnly(CONTENT),

    isValid:    isEmptyObject(ERRORS),
    isPristine: isEmptyObject(CHANGES),
    isInvalid:  not('isValid').readOnly(),
    isDirty:    not('isPristine').readOnly(),

    _bareChanges: transform(CHANGES, c => c.value),

    /*::
    _super() {},
    notifyPropertyChange() {},
    _content: {},
    _changes: {},
    _errors: {},
    _validator: defaultValidatorFn,
    _options: defaultOptions,
    _runningValidations: {},
    trigger() {},
    */

    init() {
      let c /*: ChangesetDef */ = this;
      c._super(...arguments);