feat(runtime-dom): allow native Set as v-model checkbox source (#1957)
This commit is contained in:
@@ -58,6 +58,9 @@ export const hasOwn = (
|
||||
): key is keyof typeof val => hasOwnProperty.call(val, key)
|
||||
|
||||
export const isArray = Array.isArray
|
||||
export const isSet = (val: any): boolean => {
|
||||
return toRawType(val) === 'Set'
|
||||
}
|
||||
export const isDate = (val: unknown): val is Date => val instanceof Date
|
||||
export const isFunction = (val: unknown): val is Function =>
|
||||
typeof val === 'function'
|
||||
|
||||
@@ -51,3 +51,10 @@ export function looseEqual(a: any, b: any): boolean {
|
||||
export function looseIndexOf(arr: any[], val: any): number {
|
||||
return arr.findIndex(item => looseEqual(item, val))
|
||||
}
|
||||
|
||||
export function looseHas(set: Set<any>, val: any): boolean {
|
||||
for (let item of set) {
|
||||
if (looseEqual(item, val)) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user