fix(reactivity): account for NaN in value change checks (#361)

This commit is contained in:
Mayness
2019-10-23 10:53:43 -05:00
committed by Evan You
parent 11d0778f9c
commit 18a349ce8c
7 changed files with 47 additions and 8 deletions

View File

@@ -67,3 +67,7 @@ export const hyphenate = (str: string): string => {
export const capitalize = (str: string): string => {
return str.charAt(0).toUpperCase() + str.slice(1)
}
// compare whether a value has changed, accounting for NaN.
export const hasChanged = (value: any, oldValue: any): boolean =>
value !== oldValue && (value === value || oldValue === oldValue)