feat: iteration protocols

This commit is contained in:
James Prior
2022-07-09 18:21:54 +08:00
committed by Jun Yang
parent e87f068067
commit a19feea7c4
5 changed files with 100 additions and 2 deletions
+4
View File
@@ -60,6 +60,10 @@ export function isArray (value: any): value is any[] {
return toString.call(value) === '[object Array]'
}
export function isIterable (value: any): value is Iterable<any> {
return isObject(value) && Symbol.iterator in value
}
/*
* Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.
* The iteratee is invoked with three arguments: (value, key, object).