@libp2p/utils 6.3.1-15a70af5f → 6.3.1-4bbcfa707
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/is-async-generator.d.ts.map +1 -1
- package/dist/src/is-async-generator.js +4 -2
- package/dist/src/is-async-generator.js.map +1 -1
- package/dist/src/is-generator.d.ts.map +1 -1
- package/dist/src/is-generator.js +4 -2
- package/dist/src/is-generator.js.map +1 -1
- package/package.json +5 -5
- package/src/is-async-generator.ts +8 -2
- package/src/is-generator.ts +9 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-async-generator.d.ts","sourceRoot":"","sources":["../../src/is-async-generator.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc,
|
|
1
|
+
{"version":3,"file":"is-async-generator.d.ts","sourceRoot":"","sources":["../../src/is-async-generator.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc,CAerE"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export function isAsyncGenerator(obj) {
|
|
2
|
-
if (obj == null)
|
|
2
|
+
if (obj == null) {
|
|
3
3
|
return false;
|
|
4
|
+
}
|
|
4
5
|
const asyncIterator = obj?.[Symbol.asyncIterator];
|
|
5
|
-
if (typeof asyncIterator !== 'function')
|
|
6
|
+
if (typeof asyncIterator !== 'function') {
|
|
6
7
|
return false;
|
|
8
|
+
}
|
|
7
9
|
const instance = obj;
|
|
8
10
|
return typeof instance.next === 'function';
|
|
9
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-async-generator.js","sourceRoot":"","sources":["../../src/is-async-generator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAE,GAAY;IAC5C,IAAI,GAAG,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"is-async-generator.js","sourceRoot":"","sources":["../../src/is-async-generator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAE,GAAY;IAC5C,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,aAAa,GAAI,GAA4C,EAAE,CACnE,MAAM,CAAC,aAAa,CACrB,CAAA;IAED,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;QACxC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,GAAyB,CAAA;IAC1C,OAAO,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAA;AAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-generator.d.ts","sourceRoot":"","sources":["../../src/is-generator.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"is-generator.d.ts","sourceRoot":"","sources":["../../src/is-generator.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,SAAS,CAc3D"}
|
package/dist/src/is-generator.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export function isGenerator(obj) {
|
|
2
|
-
if (obj == null)
|
|
2
|
+
if (obj == null) {
|
|
3
3
|
return false;
|
|
4
|
+
}
|
|
4
5
|
const iterator = obj?.[Symbol.iterator];
|
|
5
|
-
if (typeof iterator !== 'function')
|
|
6
|
+
if (typeof iterator !== 'function') {
|
|
6
7
|
return false;
|
|
8
|
+
}
|
|
7
9
|
const instance = obj;
|
|
8
10
|
return typeof instance.next === 'function';
|
|
9
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-generator.js","sourceRoot":"","sources":["../../src/is-generator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAE,GAAY;IACvC,IAAI,GAAG,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"is-generator.js","sourceRoot":"","sources":["../../src/is-generator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAE,GAAY;IACvC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,QAAQ,GAAI,GAAuC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAE5E,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,GAAyB,CAAA;IAE1C,OAAO,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAA;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/utils",
|
|
3
|
-
"version": "6.3.1-
|
|
3
|
+
"version": "6.3.1-4bbcfa707",
|
|
4
4
|
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/utils#readme",
|
|
@@ -181,9 +181,9 @@
|
|
|
181
181
|
"dependencies": {
|
|
182
182
|
"@chainsafe/is-ip": "^2.0.2",
|
|
183
183
|
"@chainsafe/netmask": "^2.0.0",
|
|
184
|
-
"@libp2p/crypto": "5.0.9-
|
|
185
|
-
"@libp2p/interface": "2.4.0-
|
|
186
|
-
"@libp2p/logger": "5.1.6-
|
|
184
|
+
"@libp2p/crypto": "5.0.9-4bbcfa707",
|
|
185
|
+
"@libp2p/interface": "2.4.0-4bbcfa707",
|
|
186
|
+
"@libp2p/logger": "5.1.6-4bbcfa707",
|
|
187
187
|
"@multiformats/multiaddr": "^12.3.3",
|
|
188
188
|
"@sindresorhus/fnv1a": "^3.1.0",
|
|
189
189
|
"@types/murmurhash3js-revisited": "^3.0.3",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"uint8arrays": "^5.1.0"
|
|
205
205
|
},
|
|
206
206
|
"devDependencies": {
|
|
207
|
-
"@libp2p/peer-id": "5.0.10-
|
|
207
|
+
"@libp2p/peer-id": "5.0.10-4bbcfa707",
|
|
208
208
|
"@types/netmask": "^2.0.5",
|
|
209
209
|
"aegir": "^45.0.5",
|
|
210
210
|
"benchmark": "^2.1.4",
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export function isAsyncGenerator (obj: unknown): obj is AsyncGenerator {
|
|
2
|
-
if (obj == null)
|
|
2
|
+
if (obj == null) {
|
|
3
|
+
return false
|
|
4
|
+
}
|
|
5
|
+
|
|
3
6
|
const asyncIterator = (obj as { [Symbol.asyncIterator]?: unknown })?.[
|
|
4
7
|
Symbol.asyncIterator
|
|
5
8
|
]
|
|
6
|
-
|
|
9
|
+
|
|
10
|
+
if (typeof asyncIterator !== 'function') {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
7
13
|
|
|
8
14
|
const instance = obj as { next?: unknown }
|
|
9
15
|
return typeof instance.next === 'function'
|
package/src/is-generator.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export function isGenerator (obj: unknown): obj is Generator {
|
|
2
|
-
if (obj == null)
|
|
2
|
+
if (obj == null) {
|
|
3
|
+
return false
|
|
4
|
+
}
|
|
5
|
+
|
|
3
6
|
const iterator = (obj as { [Symbol.iterator]?: unknown })?.[Symbol.iterator]
|
|
4
|
-
|
|
7
|
+
|
|
8
|
+
if (typeof iterator !== 'function') {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
5
11
|
|
|
6
12
|
const instance = obj as { next?: unknown }
|
|
13
|
+
|
|
7
14
|
return typeof instance.next === 'function'
|
|
8
15
|
}
|