@koine/utils 1.0.92 → 1.0.94
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/arrayOfAll.d.ts +30 -0
- package/arrayOfAll.js +34 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/node/arrayOfAll.js +38 -0
- package/node/index.js +1 -0
- package/package.json +1 -1
package/arrayOfAll.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure an array contains all deisred values
|
|
3
|
+
*
|
|
4
|
+
* @category array
|
|
5
|
+
* @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
|
|
6
|
+
*
|
|
7
|
+
* @usage
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* import { arrayOfAll } from "@koine/utils";
|
|
11
|
+
*
|
|
12
|
+
* type Fruit = "pear" | "apple" | "orange";
|
|
13
|
+
*
|
|
14
|
+
* const arrayOfAllFruits = arrayOfAll<Fruit>();
|
|
15
|
+
*
|
|
16
|
+
* const allFruits = arrayOfAllFruits([
|
|
17
|
+
* "pear",
|
|
18
|
+
* "apple",
|
|
19
|
+
* "orange"
|
|
20
|
+
* ]); // ts compiler ok
|
|
21
|
+
*
|
|
22
|
+
* const allFruits = arrayOfAllFruits([
|
|
23
|
+
* "pear",
|
|
24
|
+
* "apple",
|
|
25
|
+
* ]); // ts compiler fails
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare const arrayOfAll: <T>() => <U extends T[]>(array: U & ([T] extends [U[number]] ? unknown : "Invalid")) => U & ([T] extends [U[number]] ? unknown : "Invalid");
|
|
30
|
+
export default arrayOfAll;
|
package/arrayOfAll.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure an array contains all deisred values
|
|
3
|
+
*
|
|
4
|
+
* @category array
|
|
5
|
+
* @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
|
|
6
|
+
*
|
|
7
|
+
* @usage
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* import { arrayOfAll } from "@koine/utils";
|
|
11
|
+
*
|
|
12
|
+
* type Fruit = "pear" | "apple" | "orange";
|
|
13
|
+
*
|
|
14
|
+
* const arrayOfAllFruits = arrayOfAll<Fruit>();
|
|
15
|
+
*
|
|
16
|
+
* const allFruits = arrayOfAllFruits([
|
|
17
|
+
* "pear",
|
|
18
|
+
* "apple",
|
|
19
|
+
* "orange"
|
|
20
|
+
* ]); // ts compiler ok
|
|
21
|
+
*
|
|
22
|
+
* const allFruits = arrayOfAllFruits([
|
|
23
|
+
* "pear",
|
|
24
|
+
* "apple",
|
|
25
|
+
* ]); // ts compiler fails
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export var arrayOfAll = function () {
|
|
30
|
+
return function (array) {
|
|
31
|
+
return array;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export default arrayOfAll;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayOfAll = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Ensure an array contains all deisred values
|
|
6
|
+
*
|
|
7
|
+
* @category array
|
|
8
|
+
* @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* import { arrayOfAll } from "@koine/utils";
|
|
14
|
+
*
|
|
15
|
+
* type Fruit = "pear" | "apple" | "orange";
|
|
16
|
+
*
|
|
17
|
+
* const arrayOfAllFruits = arrayOfAll<Fruit>();
|
|
18
|
+
*
|
|
19
|
+
* const allFruits = arrayOfAllFruits([
|
|
20
|
+
* "pear",
|
|
21
|
+
* "apple",
|
|
22
|
+
* "orange"
|
|
23
|
+
* ]); // ts compiler ok
|
|
24
|
+
*
|
|
25
|
+
* const allFruits = arrayOfAllFruits([
|
|
26
|
+
* "pear",
|
|
27
|
+
* "apple",
|
|
28
|
+
* ]); // ts compiler fails
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
var arrayOfAll = function () {
|
|
33
|
+
return function (array) {
|
|
34
|
+
return array;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.arrayOfAll = arrayOfAll;
|
|
38
|
+
exports.default = exports.arrayOfAll;
|
package/node/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./accentSets"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./addOrReplaceAtIdx"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./arrayOfAll"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./arrayToLookup"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./buildUrlQueryString"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./capitalize"), exports);
|