[BUGFIX beta] Prevent errors when using const (get arr 1).#16218
Merged
rwjblue merged 1 commit intoemberjs:masterfrom Feb 6, 2018
Merged
[BUGFIX beta] Prevent errors when using const (get arr 1).#16218rwjblue merged 1 commit intoemberjs:masterfrom
(get arr 1).#16218rwjblue merged 1 commit intoemberjs:masterfrom
Conversation
11df44d to
a65f533
Compare
Member
Author
|
FYI - The |
rwjblue
commented
Feb 6, 2018
| return referenceFromParts(sourceReference, parts); | ||
| let value = pathReference.value(); | ||
| if (typeof value === 'string' && value.indexOf('.') > -1) { | ||
| return referenceFromParts(sourceReference, value.split('.')); |
Member
Author
There was a problem hiding this comment.
FWIW, I am working on a follow up PR (which will only target master) to make the referenceFromParts utility function accept a single value (instead of an array), that will remove this duplication (here and below)...
Prior to this change, calling `{{get arr 1}}` would throw an error:
```
pathReference.value(...).split is not a function
```
This commit fixes that, by only attempting to `.split` when the
underlying value is not actually a string.
`Ember.get` / `Ember.set` are also updated to allow `get(obj, 2)`
(previously allowed only string keys).
a65f533 to
706166a
Compare
Member
Author
|
r+ from @krisselden in chat |
This was referenced Dec 6, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to this change, calling
{{get arr 1}}would throw an error:This commit fixes that, by only attempting to
.splitwhen the underlying value is not actually a string.