How to use the ember-changeset/utils/set-nested-property 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
if (isObject(error)) {
        let errorLike /*: ErrLike<*> */ = (error /*: any */);
        assert('Error must have value.', errorLike.hasOwnProperty('value'));
        assert('Error must have validation.', errorLike.hasOwnProperty('validation'));
        newError = new Err(errorLike.value, errorLike.validation);
      } else {
        let validation /*: ValidationErr */ = (error /*: any */);
        newError = new Err(get(this, key), validation);
      }

      // Remove `key` from changes map.
      let c = (this /*: ChangesetDef */);

      // Add `key` to errors map.
      let errors /*: Errors */ = get(this, ERRORS);
      setNestedProperty(errors, key, newError);
      c.notifyPropertyChange(ERRORS);

      // Notify that `key` has changed.
      c.notifyPropertyChange(key);

      // Return passed-in `error`.
      return error;
    },
github poteto / ember-changeset / addon / utils / merge-nested.ts View on Github external
keys(obj).forEach(key =>
      setNestedProperty(finalObj, key, obj[key])
    )