Skip to content

Commit

Permalink
Safe set for setDeep (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer authored May 16, 2020
1 parent 77ebff0 commit bb21eb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ export class EmberChangeset extends BufferedChangeset {
// DO NOT override setDeep. Ember.set does not work wth empty hash and nested
// key Ember.set({}, 'user.name', 'foo');
// override base class
// DO NOT override setDeep. Ember.set does not work with Ember.set({}, 'user.name', 'foo');
getDeep = safeGet;

// override base class
safeGet(obj, key) {
return safeGet(obj, key);
}
safeSet(obj, key, value) {
return safeSet(obj, key, value);
}

/**
* Manually add an error to the changeset. If there is an existing
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"ember-auto-import": "^1.5.2",
"@glimmer/tracking": "^1.0.0",
"ember-cli-babel": "^7.19.0",
"validated-changeset": "~0.4.7"
"validated-changeset": "~0.4.8"
},
"devDependencies": {
"@ember/optional-features": "^1.0.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12730,10 +12730,10 @@ validate-npm-package-name@~2.2.2:
dependencies:
builtins "0.0.7"

validated-changeset@~0.4.7:
version "0.4.7"
resolved "https://registry.yarnpkg.com/validated-changeset/-/validated-changeset-0.4.7.tgz#f80716a71a090afc6e40e8d9af2f8895013728c9"
integrity sha512-tjiz4ym/n8S0i7CgzBU8Wq1Y/+723kI20Gv/+wnlzkpMYVQYClSSt9mbCFlneopm6rTAO9nBTBFNuqxSFqGYCA==
validated-changeset@~0.4.8:
version "0.4.8"
resolved "https://registry.yarnpkg.com/validated-changeset/-/validated-changeset-0.4.8.tgz#7f44501395e24af29368f95e70bb2f606cb0b18f"
integrity sha512-hL+EW0wMVidc0IGeqd9FzPJryrQ88aNMQrSLpyFtoZtcb5NoMW1m47whWxDK4o+oW93nasf1LUVJdvftw3pmKw==

vary@~1.1.2:
version "1.1.2"
Expand Down

0 comments on commit bb21eb0

Please sign in to comment.