is-what 5.0.1 → 5.1.0
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/isFunction.d.ts +1 -1
- package/dist/isIterable.d.ts +2 -0
- package/dist/isIterable.js +14 -0
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
@@ -16,6 +16,7 @@ export { isFullString } from './isFullString.js';
|
|
16
16
|
export { isFunction } from './isFunction.js';
|
17
17
|
export type { AnyFunction } from './isFunction.js';
|
18
18
|
export { isInstanceOf } from './isInstanceOf.js';
|
19
|
+
export { isIterable } from './isIterable.js';
|
19
20
|
export { isMap } from './isMap.js';
|
20
21
|
export { isNaNValue } from './isNaNValue.js';
|
21
22
|
export { isNegativeNumber } from './isNegativeNumber.js';
|
package/dist/index.js
CHANGED
@@ -14,6 +14,7 @@ export { isFullObject } from './isFullObject.js';
|
|
14
14
|
export { isFullString } from './isFullString.js';
|
15
15
|
export { isFunction } from './isFunction.js';
|
16
16
|
export { isInstanceOf } from './isInstanceOf.js';
|
17
|
+
export { isIterable } from './isIterable.js';
|
17
18
|
export { isMap } from './isMap.js';
|
18
19
|
export { isNaNValue } from './isNaNValue.js';
|
19
20
|
export { isNegativeNumber } from './isNegativeNumber.js';
|
package/dist/isFunction.d.ts
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
/** Returns whether the payload is an iterable (regular or async) */
|
2
|
+
export function isIterable(payload) {
|
3
|
+
if (typeof Symbol === 'undefined' || typeof Symbol.iterator === 'undefined') {
|
4
|
+
return false;
|
5
|
+
}
|
6
|
+
if (payload == null)
|
7
|
+
return false;
|
8
|
+
// Strings are iterable, even though they're primitives.
|
9
|
+
if (typeof payload === 'string')
|
10
|
+
return true;
|
11
|
+
// For objects, arrays and functions, check if Symbol.iterator is a function.
|
12
|
+
return ((typeof payload === 'object' || typeof payload === 'function') &&
|
13
|
+
typeof payload[Symbol.iterator] === 'function');
|
14
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "is-what",
|
3
|
-
"version": "5.0
|
3
|
+
"version": "5.1.0",
|
4
4
|
"description": "JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.",
|
5
5
|
"type": "module",
|
6
6
|
"sideEffects": false,
|
@@ -19,12 +19,12 @@
|
|
19
19
|
"release": "npm run lint && npm run build && np"
|
20
20
|
},
|
21
21
|
"devDependencies": {
|
22
|
-
"@cycraft/eslint": "^0.
|
22
|
+
"@cycraft/eslint": "^0.4.1",
|
23
23
|
"@cycraft/tsconfig": "^0.1.2",
|
24
|
-
"del-cli": "^
|
25
|
-
"np": "^10.0
|
26
|
-
"typedoc": "^0.
|
27
|
-
"vitest": "^
|
24
|
+
"del-cli": "^6.0.0",
|
25
|
+
"np": "^10.2.0",
|
26
|
+
"typedoc": "^0.27.7",
|
27
|
+
"vitest": "^3.0.5"
|
28
28
|
},
|
29
29
|
"files": [
|
30
30
|
"dist"
|