feat: size, first, last support arraylike objects, #781

This commit is contained in:
Harttle
2024-12-28 16:10:06 +08:00
committed by Jun Yang
parent bb08cfab1f
commit 35a84421a6
3 changed files with 10 additions and 12 deletions
+4
View File
@@ -93,6 +93,10 @@ export function isArray (value: any): value is any[] {
return toString.call(value) === '[object Array]'
}
export function isArrayLike (value: any): value is any[] {
return value && isNumber(value.length)
}
export function isIterable (value: any): value is Iterable<any> {
return isObject(value) && Symbol.iterator in value
}