@libp2p/utils
Advanced tools
Comparing version 6.3.1-15a70af5f to 6.3.1-4bbcfa707
export function isAsyncGenerator(obj) { | ||
if (obj == null) | ||
if (obj == null) { | ||
return false; | ||
} | ||
const asyncIterator = obj?.[Symbol.asyncIterator]; | ||
if (typeof asyncIterator !== 'function') | ||
if (typeof asyncIterator !== 'function') { | ||
return false; | ||
} | ||
const instance = obj; | ||
@@ -8,0 +10,0 @@ return typeof instance.next === 'function'; |
export function isGenerator(obj) { | ||
if (obj == null) | ||
if (obj == null) { | ||
return false; | ||
} | ||
const iterator = obj?.[Symbol.iterator]; | ||
if (typeof iterator !== 'function') | ||
if (typeof iterator !== 'function') { | ||
return false; | ||
} | ||
const instance = obj; | ||
@@ -8,0 +10,0 @@ return typeof instance.next === 'function'; |
{ | ||
"name": "@libp2p/utils", | ||
"version": "6.3.1-15a70af5f", | ||
"version": "6.3.1-4bbcfa707", | ||
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem", | ||
@@ -184,5 +184,5 @@ "license": "Apache-2.0 OR MIT", | ||
"@chainsafe/netmask": "^2.0.0", | ||
"@libp2p/crypto": "5.0.9-15a70af5f", | ||
"@libp2p/interface": "2.4.0-15a70af5f", | ||
"@libp2p/logger": "5.1.6-15a70af5f", | ||
"@libp2p/crypto": "5.0.9-4bbcfa707", | ||
"@libp2p/interface": "2.4.0-4bbcfa707", | ||
"@libp2p/logger": "5.1.6-4bbcfa707", | ||
"@multiformats/multiaddr": "^12.3.3", | ||
@@ -208,3 +208,3 @@ "@sindresorhus/fnv1a": "^3.1.0", | ||
"devDependencies": { | ||
"@libp2p/peer-id": "5.0.10-15a70af5f", | ||
"@libp2p/peer-id": "5.0.10-4bbcfa707", | ||
"@types/netmask": "^2.0.5", | ||
@@ -211,0 +211,0 @@ "aegir": "^45.0.5", |
export function isAsyncGenerator (obj: unknown): obj is AsyncGenerator { | ||
if (obj == null) return false | ||
if (obj == null) { | ||
return false | ||
} | ||
const asyncIterator = (obj as { [Symbol.asyncIterator]?: unknown })?.[ | ||
Symbol.asyncIterator | ||
] | ||
if (typeof asyncIterator !== 'function') return false | ||
if (typeof asyncIterator !== 'function') { | ||
return false | ||
} | ||
const instance = obj as { next?: unknown } | ||
return typeof instance.next === 'function' | ||
} |
export function isGenerator (obj: unknown): obj is Generator { | ||
if (obj == null) return false | ||
if (obj == null) { | ||
return false | ||
} | ||
const iterator = (obj as { [Symbol.iterator]?: unknown })?.[Symbol.iterator] | ||
if (typeof iterator !== 'function') return false | ||
if (typeof iterator !== 'function') { | ||
return false | ||
} | ||
const instance = obj as { next?: unknown } | ||
return typeof instance.next === 'function' | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
278511
5283
+ Added@libp2p/crypto@5.0.9-4bbcfa707(transitive)
+ Added@libp2p/interface@2.4.0-4bbcfa707(transitive)
+ Added@libp2p/logger@5.1.6-4bbcfa707(transitive)
- Removed@libp2p/crypto@5.0.9-15a70af5f(transitive)
- Removed@libp2p/interface@2.4.0-15a70af5f(transitive)
- Removed@libp2p/logger@5.1.6-15a70af5f(transitive)