refactor: rename toValue to toValueSync

This commit is contained in:
Harttle
2022-07-10 00:24:00 +08:00
parent c3e51caa70
commit 4289b4e804
7 changed files with 77 additions and 37 deletions
+8
View File
@@ -14,6 +14,14 @@ export function isFunction (value: any): value is Function {
return typeof value === 'function'
}
export function isPromise<T> (val: any): val is Promise<T> {
return val && isFunction(val.then)
}
export function isIterator (val: any): val is IterableIterator<any> {
return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return)
}
export function escapeRegex (str: string) {
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')
}