is-any-array 2.0.0 → 3.0.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/README.md +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -10
- package/lib/index.js.map +1 -1
- package/package.json +18 -19
- package/src/index.ts +24 -0
- package/CHANGELOG.md +0 -40
- package/lib-esm/index.d.ts +0 -8
- package/lib-esm/index.d.ts.map +0 -1
- package/lib-esm/index.js +0 -11
- package/lib-esm/index.js.map +0 -1
- package/src/__tests__/test.js +0 -11
- package/src/index.js +0 -11
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ isAnyArray(new Uint16Array(2))) // true;
|
|
|
29
29
|
|
|
30
30
|
[npm-image]: https://img.shields.io/npm/v/is-any-array.svg
|
|
31
31
|
[npm-url]: https://www.npmjs.com/package/is-any-array
|
|
32
|
-
[build-image]: https://github.com/cheminfo/is-any-array/workflows/Node.js%20CI/badge.svg?branch=
|
|
32
|
+
[build-image]: https://github.com/cheminfo/is-any-array/workflows/Node.js%20CI/badge.svg?branch=main
|
|
33
33
|
[build-url]: https://github.com/cheminfo/is-any-array/actions?query=workflow%3A%22Node.js+CI%22
|
|
34
34
|
[download-image]: https://img.shields.io/npm/dm/is-any-array.svg
|
|
35
35
|
[download-url]: https://www.npmjs.com/package/is-any-array
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export type AnyArray = any[] | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
1
2
|
/**
|
|
2
|
-
* Checks if an object is an instance of an Array (array or typed array).
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
5
|
-
* @returns {boolean} True if the object is an array.
|
|
3
|
+
* Checks if an object is an instance of an Array (array or typed array, except those that contain bigint values).
|
|
4
|
+
* @param value - Object to check.
|
|
5
|
+
* @returns True if the object is an array or a typed array.
|
|
6
6
|
*/
|
|
7
|
-
export function isAnyArray(value:
|
|
7
|
+
export declare function isAnyArray(value: unknown): value is AnyArray;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAChB,GAAG,EAAE,GACL,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAG5D"}
|
package/lib/index.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAnyArray = void 0;
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
4
2
|
const toString = Object.prototype.toString;
|
|
5
3
|
/**
|
|
6
|
-
* Checks if an object is an instance of an Array (array or typed array).
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
* @returns {boolean} True if the object is an array.
|
|
4
|
+
* Checks if an object is an instance of an Array (array or typed array, except those that contain bigint values).
|
|
5
|
+
* @param value - Object to check.
|
|
6
|
+
* @returns True if the object is an array or a typed array.
|
|
10
7
|
*/
|
|
11
|
-
function isAnyArray(value) {
|
|
12
|
-
|
|
8
|
+
export function isAnyArray(value) {
|
|
9
|
+
const tag = toString.call(value);
|
|
10
|
+
return tag.endsWith('Array]') && !tag.includes('Big');
|
|
13
11
|
}
|
|
14
|
-
exports.isAnyArray = isAnyArray;
|
|
15
12
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AAc3C;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "is-any-array",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Check if a value is any kind of array",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./lib/index.js"
|
|
8
|
+
},
|
|
7
9
|
"types": "./lib/index.d.ts",
|
|
8
10
|
"files": [
|
|
9
11
|
"lib",
|
|
10
|
-
"lib-esm",
|
|
11
12
|
"src"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
15
|
"check-types": "tsc --noEmit",
|
|
15
|
-
"clean": "rimraf lib
|
|
16
|
+
"clean": "rimraf lib",
|
|
16
17
|
"eslint": "eslint src",
|
|
17
18
|
"eslint-fix": "npm run eslint -- --fix",
|
|
18
19
|
"prepack": "npm run tsc",
|
|
19
20
|
"prettier": "prettier --check src",
|
|
20
21
|
"prettier-write": "prettier --write src",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"tsc
|
|
24
|
-
"
|
|
25
|
-
"test-coverage": "jest --coverage",
|
|
26
|
-
"test-only": "jest"
|
|
22
|
+
"test": "npm run test-only && npm run check-types && npm run eslint && npm run prettier",
|
|
23
|
+
"test-only": "vitest run --coverage",
|
|
24
|
+
"tsc": "npm run clean && npm run tsc-build",
|
|
25
|
+
"tsc-build": "tsc --project tsconfig.build.json"
|
|
27
26
|
},
|
|
28
27
|
"repository": {
|
|
29
28
|
"type": "git",
|
|
@@ -37,13 +36,13 @@
|
|
|
37
36
|
},
|
|
38
37
|
"homepage": "https://github.com/cheminfo-js/is-any-array#readme",
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"eslint
|
|
43
|
-
"
|
|
44
|
-
"prettier": "^
|
|
45
|
-
"rimraf": "^
|
|
46
|
-
"
|
|
47
|
-
"
|
|
39
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
40
|
+
"@zakodium/tsconfig": "^1.0.2",
|
|
41
|
+
"eslint": "^9.39.2",
|
|
42
|
+
"eslint-config-cheminfo-typescript": "^21.1.0",
|
|
43
|
+
"prettier": "^3.8.1",
|
|
44
|
+
"rimraf": "^6.1.3",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"vitest": "^4.0.18"
|
|
48
47
|
}
|
|
49
48
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
2
|
+
const toString = Object.prototype.toString;
|
|
3
|
+
|
|
4
|
+
export type AnyArray =
|
|
5
|
+
| any[] // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
6
|
+
| Int8Array
|
|
7
|
+
| Uint8Array
|
|
8
|
+
| Uint8ClampedArray
|
|
9
|
+
| Int16Array
|
|
10
|
+
| Uint16Array
|
|
11
|
+
| Int32Array
|
|
12
|
+
| Uint32Array
|
|
13
|
+
| Float32Array
|
|
14
|
+
| Float64Array;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Checks if an object is an instance of an Array (array or typed array, except those that contain bigint values).
|
|
18
|
+
* @param value - Object to check.
|
|
19
|
+
* @returns True if the object is an array or a typed array.
|
|
20
|
+
*/
|
|
21
|
+
export function isAnyArray(value: unknown): value is AnyArray {
|
|
22
|
+
const tag = toString.call(value);
|
|
23
|
+
return tag.endsWith('Array]') && !tag.includes('Big');
|
|
24
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [2.0.0](https://www.github.com/cheminfo/is-any-array/compare/v1.0.1...v2.0.0) (2021-10-15)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### ⚠ BREAKING CHANGES
|
|
7
|
-
|
|
8
|
-
When using this project you will need to use a named import: `import { isAnyArray } from 'is-any-array'`.
|
|
9
|
-
|
|
10
|
-
### Code Refactoring
|
|
11
|
-
|
|
12
|
-
* setup project for TypeScript ([#7](https://www.github.com/cheminfo/is-any-array/issues/7)) ([21e47a0](https://www.github.com/cheminfo/is-any-array/commit/21e47a02e36987208b5aa22906c1cbfee3322775))
|
|
13
|
-
|
|
14
|
-
### [1.0.1](https://www.github.com/cheminfo/is-any-array/compare/v1.0.0...v1.0.1) (2021-06-30)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Bug Fixes
|
|
18
|
-
|
|
19
|
-
* rollup in dependencies ! ([7c26c34](https://www.github.com/cheminfo/is-any-array/commit/7c26c3416287c57eaeb9fc481fb2a7b107cfa984))
|
|
20
|
-
|
|
21
|
-
## [1.0.0](https://www.github.com/cheminfo/is-any-array/compare/v0.1.1...v1.0.0) (2021-03-24)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Bug Fixes
|
|
25
|
-
|
|
26
|
-
* update readme and dependencies ([7ae8169](https://www.github.com/cheminfo/is-any-array/commit/7ae8169b1105bc9e3586f6a73315897326bb1bd4))
|
|
27
|
-
|
|
28
|
-
### [0.1.1](https://github.com/cheminfo-js/is-any-array/compare/v0.1.0...v0.1.1) (2021-02-11)
|
|
29
|
-
|
|
30
|
-
# [0.1.0](https://github.com/cheminfo-js/is-any-array/compare/v0.0.3...v0.1.0) (2020-02-25)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<a name="0.0.3"></a>
|
|
35
|
-
## [0.0.3](https://github.com/cheminfo-js/is-any-array/compare/v0.0.2...v0.0.3) (2018-10-26)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<a name="0.0.2"></a>
|
|
40
|
-
## 0.0.2 (2018-10-26)
|
package/lib-esm/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if an object is an instance of an Array (array or typed array).
|
|
3
|
-
*
|
|
4
|
-
* @param {any} value - Object to check.
|
|
5
|
-
* @returns {boolean} True if the object is an array.
|
|
6
|
-
*/
|
|
7
|
-
export function isAnyArray(value: any): boolean;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib-esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,kCAHW,GAAG,GACD,OAAO,CAInB"}
|
package/lib-esm/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const toString = Object.prototype.toString;
|
|
2
|
-
/**
|
|
3
|
-
* Checks if an object is an instance of an Array (array or typed array).
|
|
4
|
-
*
|
|
5
|
-
* @param {any} value - Object to check.
|
|
6
|
-
* @returns {boolean} True if the object is an array.
|
|
7
|
-
*/
|
|
8
|
-
export function isAnyArray(value) {
|
|
9
|
-
return toString.call(value).endsWith('Array]');
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
package/lib-esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAK;IAC9B,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACjD,CAAC"}
|
package/src/__tests__/test.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isAnyArray } from '..';
|
|
2
|
-
|
|
3
|
-
test('isArray', () => {
|
|
4
|
-
expect(isAnyArray(1)).toBe(false);
|
|
5
|
-
expect(isAnyArray('ab')).toBe(false);
|
|
6
|
-
expect(isAnyArray({ a: 1 })).toBe(false);
|
|
7
|
-
|
|
8
|
-
expect(isAnyArray([])).toBe(true);
|
|
9
|
-
expect(isAnyArray([1, 2, 3])).toBe(true);
|
|
10
|
-
expect(isAnyArray(new Uint16Array(2))).toBe(true);
|
|
11
|
-
});
|
package/src/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const toString = Object.prototype.toString;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checks if an object is an instance of an Array (array or typed array).
|
|
5
|
-
*
|
|
6
|
-
* @param {any} value - Object to check.
|
|
7
|
-
* @returns {boolean} True if the object is an array.
|
|
8
|
-
*/
|
|
9
|
-
export function isAnyArray(value) {
|
|
10
|
-
return toString.call(value).endsWith('Array]');
|
|
11
|
-
}
|