fix: allow an object's Symbols to be observed (#6704)

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.
This commit is contained in:
Derek Kent 2017-09-28 10:53:40 -04:00 committed by Evan You
parent 4361a2b3ae
commit 4fd2ce813c

View File

@ -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)
}