Skip to content

Commit

Permalink
Allow an object's Symbols to be observed
Browse files Browse the repository at this point in the history
Attempting to parseFloat on a Symbol throws the error
`Cannot convert a Symbol value to a string`.

A Symbol can be cast to a string using `.toString()` or `String()` though,
so explicitly casting before parsing resolves the issue, allowing `Vue.set` to
be called on Symbols.
  • Loading branch information
dak committed Sep 28, 2017
1 parent 78fb666 commit 2a35e59
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/shared/util.js
Expand Up @@ -56,7 +56,7 @@ export function isRegExp (v: any): boolean {
* Check if val is a valid array index.
*/
export function isValidArrayIndex (val: any): boolean {
const n = parseFloat(val)
const n = parseFloat(String(val))
return n >= 0 && Math.floor(n) === n && isFinite(val)
}

Expand Down

0 comments on commit 2a35e59

Please sign in to comment.