anyone 2.0.0 → 2.0.2
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/CHANGELOG.md +1 -16
- package/README.md +26 -98
- package/all/package.json +12 -5
- package/any/package.json +12 -5
- package/dist/all-G56EfCZm.cjs +18 -0
- package/dist/all-G56EfCZm.cjs.map +1 -0
- package/dist/all-jZqtYMoF.mjs +13 -0
- package/dist/all-jZqtYMoF.mjs.map +1 -0
- package/dist/any-7W0t-5U9.cjs +18 -0
- package/dist/any-7W0t-5U9.cjs.map +1 -0
- package/dist/any-Bu9n0b6b.mjs +13 -0
- package/dist/any-Bu9n0b6b.mjs.map +1 -0
- package/dist/anyone.cjs +10 -0
- package/dist/anyone.mjs +7 -0
- package/dist/exports/all.cjs +4 -0
- package/dist/exports/all.mjs +4 -0
- package/dist/exports/any.cjs +4 -0
- package/dist/exports/any.mjs +4 -0
- package/dist/exports/none.cjs +4 -0
- package/dist/exports/none.mjs +4 -0
- package/dist/exports/one.cjs +4 -0
- package/dist/exports/one.mjs +4 -0
- package/dist/none-BaiW3V_k.mjs +14 -0
- package/dist/none-BaiW3V_k.mjs.map +1 -0
- package/dist/none-BvnsAgF8.cjs +19 -0
- package/dist/none-BvnsAgF8.cjs.map +1 -0
- package/dist/one-C-TngTWp.cjs +23 -0
- package/dist/one-C-TngTWp.cjs.map +1 -0
- package/dist/one-D5UWawb-.mjs +18 -0
- package/dist/one-D5UWawb-.mjs.map +1 -0
- package/dist/runAnyoneMethods-BnV5_696.cjs +26 -0
- package/dist/runAnyoneMethods-BnV5_696.cjs.map +1 -0
- package/dist/runAnyoneMethods-CiYJATON.mjs +21 -0
- package/dist/runAnyoneMethods-CiYJATON.mjs.map +1 -0
- package/none/package.json +12 -5
- package/one/package.json +12 -5
- package/package.json +68 -146
- package/src/__tests__/all.test.ts +47 -0
- package/src/__tests__/any.test.ts +60 -0
- package/src/__tests__/anyoneTestValues.ts +3 -0
- package/src/__tests__/none.test.ts +60 -0
- package/src/__tests__/one.test.ts +56 -0
- package/src/__tests__/runAnyoneMethods.test.ts +43 -0
- package/src/anyone.ts +4 -0
- package/src/exports/all.ts +8 -0
- package/src/exports/any.ts +8 -0
- package/src/exports/none.ts +10 -0
- package/src/exports/one.ts +20 -0
- package/src/runner/runAnyoneMethods.ts +21 -0
- package/types/{all.d.ts → all-8-fac2En.d.mts} +4 -1
- package/types/all-8-fac2En.d.mts.map +1 -0
- package/types/all-DT3n67Q2.d.cts +8 -0
- package/types/all-DT3n67Q2.d.cts.map +1 -0
- package/types/{any.d.ts → any-BDnUW0EC.d.mts} +4 -1
- package/types/any-BDnUW0EC.d.mts.map +1 -0
- package/types/any-BMwz5-AB.d.cts +8 -0
- package/types/any-BMwz5-AB.d.cts.map +1 -0
- package/types/anyone.d.cts +5 -0
- package/types/anyone.d.mts +5 -0
- package/types/anyone.d.ts +5 -17
- package/types/exports/all.d.cts +2 -0
- package/types/exports/all.d.mts +2 -0
- package/types/exports/any.d.cts +2 -0
- package/types/exports/any.d.mts +2 -0
- package/types/exports/none.d.cts +2 -0
- package/types/exports/none.d.mts +2 -0
- package/types/exports/one.d.cts +2 -0
- package/types/exports/one.d.mts +2 -0
- package/types/{none.d.ts → none-CKjw9Aoz.d.mts} +4 -1
- package/types/none-CKjw9Aoz.d.mts.map +1 -0
- package/types/none-D0Wo1a6R.d.cts +8 -0
- package/types/none-D0Wo1a6R.d.cts.map +1 -0
- package/types/{one.d.ts → one-BuVF-m86.d.cts} +4 -1
- package/types/one-BuVF-m86.d.cts.map +1 -0
- package/types/one-PuTrzIUg.d.mts +8 -0
- package/types/one-PuTrzIUg.d.mts.map +1 -0
- package/vitest.config.ts +21 -0
- package/dist/cjs/all.development.js +0 -37
- package/dist/cjs/all.js +0 -7
- package/dist/cjs/all.production.js +0 -1
- package/dist/cjs/any.development.js +0 -37
- package/dist/cjs/any.js +0 -7
- package/dist/cjs/any.production.js +0 -1
- package/dist/cjs/anyone.development.js +0 -94
- package/dist/cjs/anyone.js +0 -7
- package/dist/cjs/anyone.production.js +0 -1
- package/dist/cjs/none.development.js +0 -47
- package/dist/cjs/none.js +0 -7
- package/dist/cjs/none.production.js +0 -1
- package/dist/cjs/one.development.js +0 -46
- package/dist/cjs/one.js +0 -7
- package/dist/cjs/one.production.js +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/es/all.development.js +0 -35
- package/dist/es/all.production.js +0 -1
- package/dist/es/any.development.js +0 -35
- package/dist/es/any.production.js +0 -1
- package/dist/es/anyone.development.js +0 -87
- package/dist/es/anyone.production.js +0 -1
- package/dist/es/none.development.js +0 -45
- package/dist/es/none.production.js +0 -1
- package/dist/es/one.development.js +0 -44
- package/dist/es/one.production.js +0 -1
- package/dist/es/package.json +0 -1
- package/dist/umd/all.development.js +0 -43
- package/dist/umd/all.production.js +0 -1
- package/dist/umd/any.development.js +0 -43
- package/dist/umd/any.production.js +0 -1
- package/dist/umd/anyone.development.js +0 -100
- package/dist/umd/anyone.production.js +0 -1
- package/dist/umd/none.development.js +0 -53
- package/dist/umd/none.production.js +0 -1
- package/dist/umd/one.development.js +0 -52
- package/dist/umd/one.production.js +0 -1
- package/tsconfig.json +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,23 +5,8 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
## 2.0.0 - 2021-12-24
|
|
8
|
-
### Changed or removed
|
|
9
|
-
- e8652bc breaking(vest, enforce): prepare next major (ealush)
|
|
10
|
-
- dab8e00 breaking(vest, enforce): prepare next major (ealush)
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
- 825e74b types(n4s): fix proxy type (ealush)
|
|
14
|
-
- 9f9b970 vx: improve package.json generation (ealush)
|
|
15
|
-
- 03ba92c vx: support namespaced exports (ealush)
|
|
16
|
-
- bed7040 vx: add back to workspace (ealush)
|
|
17
|
-
- f2d458d update build artifacts (ealush)
|
|
18
|
-
- package.json
|
|
19
|
-
- .husky/pre-commit
|
|
20
|
-
- 4d88c04 patch: add nodejs exports (undefined)
|
|
21
|
-
- 26af06b chore: reduce complexity, remove all lint errors (undefined)
|
|
22
|
-
- .github/PULL_REQUEST_TEMPLATE.md
|
|
23
|
-
- ba68539 lint: handling lint of all packages (ealush)
|
|
24
|
-
- .gitignore
|
|
9
|
+
- Use named exports
|
|
25
10
|
|
|
26
11
|
## 0.1.21 - 2021-07-02
|
|
27
12
|
|
package/README.md
CHANGED
|
@@ -1,120 +1,48 @@
|
|
|
1
1
|
# anyone
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Utility helpers that answer simple boolean questions about a list of values or callbacks. Each helper evaluates the provided arguments left-to-right (calling functions to get their return value) and returns a boolean.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- `any` – returns `true` when at least one argument is truthy.
|
|
6
|
+
- `all` – returns `true` only when every argument is truthy.
|
|
7
|
+
- `one` – returns `true` when exactly one argument is truthy.
|
|
8
|
+
- `none` – returns `true` when no arguments are truthy.
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
- `one` - Checks that only one of the supplied expressions evaluates to true (Mutual exclusion).
|
|
9
|
-
- `all` - Checks that all of the supplied expressions evaluate to true.
|
|
10
|
-
- `none` - Checks that none of the supplied expressions evaluates to true.
|
|
11
|
-
|
|
12
|
-
They all accept any amount of arguments, or no arguments at all. If a function is passed, it will be run and its value will be evaluated. Return value is always a boolean.
|
|
13
|
-
|
|
14
|
-
All functions other than `one` will short circuit when realizing the condition is not met.
|
|
15
|
-
|
|
16
|
-
## Why use it
|
|
17
|
-
|
|
18
|
-
In most cases (other than `one`) you can do just fine using `Array.prototype.some` and `Array.prototype.every`, some of these functions are used internally by Vest.
|
|
19
|
-
|
|
20
|
-
- You can use these functions as conditionals:
|
|
21
|
-
|
|
22
|
-
```js
|
|
23
|
-
if (one(var1, var2, var3)) {
|
|
24
|
-
// will reach here if ONLY ONE of the arguments is true
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- You can use these functions to pause execution of some code after a condition is met
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
all(
|
|
32
|
-
validateInput1, // returns true
|
|
33
|
-
validateInput2, // returns false
|
|
34
|
-
validateInput3 // no need to run this, we already know our validation failed
|
|
35
|
-
);
|
|
36
|
-
```
|
|
10
|
+
All helpers accept any number of values. If an argument is a function, it will be executed and its return value is used in the check. Calls short-circuit as soon as the outcome is known (except for `one`, which must evaluate the whole list).
|
|
37
11
|
|
|
38
12
|
## Installation
|
|
39
13
|
|
|
40
|
-
```
|
|
14
|
+
```bash
|
|
41
15
|
npm i anyone
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```js
|
|
16
|
+
# or
|
|
45
17
|
yarn add anyone
|
|
46
18
|
```
|
|
47
19
|
|
|
48
|
-
## Usage
|
|
20
|
+
## Usage
|
|
49
21
|
|
|
50
22
|
```js
|
|
51
23
|
import { any, one, all, none } from 'anyone';
|
|
52
|
-
```
|
|
53
24
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
import one from 'anyone/one';
|
|
57
|
-
import none from 'anyone/none';
|
|
58
|
-
import all from 'anyone/all';
|
|
59
|
-
|
|
60
|
-
any(
|
|
61
|
-
someFunction, // evaluates to false
|
|
62
|
-
1,
|
|
63
|
-
someVar // truthy
|
|
64
|
-
);
|
|
65
|
-
// true
|
|
66
|
-
|
|
67
|
-
// --------
|
|
68
|
-
|
|
69
|
-
any(
|
|
70
|
-
someFunction, // evaluates to false
|
|
71
|
-
0,
|
|
72
|
-
someVar // falsy
|
|
73
|
-
);
|
|
74
|
-
// false
|
|
75
|
-
|
|
76
|
-
// --------
|
|
77
|
-
|
|
78
|
-
one(
|
|
79
|
-
someFunction, // evaluates to false
|
|
80
|
-
0,
|
|
81
|
-
someVar // truthy
|
|
82
|
-
);
|
|
83
|
-
// true
|
|
25
|
+
const maybeTrue = () => true;
|
|
26
|
+
const alwaysFalse = () => false;
|
|
84
27
|
|
|
85
|
-
|
|
28
|
+
any(alwaysFalse, 0, 'value');
|
|
29
|
+
// → true ("value" is truthy)
|
|
86
30
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
1,
|
|
90
|
-
someVar // truthy
|
|
91
|
-
);
|
|
92
|
-
// false
|
|
31
|
+
all(1, maybeTrue, 'ok');
|
|
32
|
+
// → true
|
|
93
33
|
|
|
94
|
-
|
|
34
|
+
one(alwaysFalse, null, 5);
|
|
35
|
+
// → true (only the number is truthy)
|
|
95
36
|
|
|
96
|
-
none(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
someVar // falsy
|
|
100
|
-
);
|
|
101
|
-
// true
|
|
102
|
-
|
|
103
|
-
// --------
|
|
104
|
-
|
|
105
|
-
all(
|
|
106
|
-
someFunction, // evaluates to false
|
|
107
|
-
0,
|
|
108
|
-
someVar // truthy
|
|
109
|
-
);
|
|
110
|
-
// false
|
|
37
|
+
none(alwaysFalse, 0, '', () => false);
|
|
38
|
+
// → true (no truthy values found)
|
|
39
|
+
```
|
|
111
40
|
|
|
112
|
-
|
|
41
|
+
You can also import the helpers individually:
|
|
113
42
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// true
|
|
43
|
+
```js
|
|
44
|
+
import any from 'anyone/any';
|
|
45
|
+
import one from 'anyone/one';
|
|
46
|
+
import all from 'anyone/all';
|
|
47
|
+
import none from 'anyone/none';
|
|
120
48
|
```
|
package/all/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"exports": {
|
|
3
|
+
".": {
|
|
4
|
+
"default": "../dist/exports/all.mjs",
|
|
5
|
+
"import": "../dist/exports/all.mjs",
|
|
6
|
+
"require": "../dist/exports/all.cjs",
|
|
7
|
+
"types": "../types/exports/all.d.mts"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"main": "../dist/exports/all.cjs",
|
|
11
|
+
"module": "../dist/exports/all.mjs",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"types": "../types/exports/all.d.mts"
|
|
7
14
|
}
|
package/any/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"exports": {
|
|
3
|
+
".": {
|
|
4
|
+
"default": "../dist/exports/any.mjs",
|
|
5
|
+
"import": "../dist/exports/any.mjs",
|
|
6
|
+
"require": "../dist/exports/any.cjs",
|
|
7
|
+
"types": "../types/exports/any.d.mts"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"main": "../dist/exports/any.cjs",
|
|
11
|
+
"module": "../dist/exports/any.mjs",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"types": "../types/exports/any.d.mts"
|
|
7
14
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_runAnyoneMethods = require('./runAnyoneMethods-BnV5_696.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/exports/all.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks that at all passed arguments evaluate to a truthy value.
|
|
6
|
+
*/
|
|
7
|
+
function all(...args) {
|
|
8
|
+
return args.every(require_runAnyoneMethods.run);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
Object.defineProperty(exports, 'all', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return all;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=all-G56EfCZm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-G56EfCZm.cjs","names":["run"],"sources":["../src/exports/all.ts"],"sourcesContent":["import run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at all passed arguments evaluate to a truthy value.\n */\nexport default function all(...args: unknown[]): boolean {\n return args.every(run);\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,GAAG,MAA0B;AACvD,QAAO,KAAK,MAAMA,6BAAI"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as run } from "./runAnyoneMethods-CiYJATON.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/all.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks that at all passed arguments evaluate to a truthy value.
|
|
6
|
+
*/
|
|
7
|
+
function all(...args) {
|
|
8
|
+
return args.every(run);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { all as t };
|
|
13
|
+
//# sourceMappingURL=all-jZqtYMoF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-jZqtYMoF.mjs","names":[],"sources":["../src/exports/all.ts"],"sourcesContent":["import run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at all passed arguments evaluate to a truthy value.\n */\nexport default function all(...args: unknown[]): boolean {\n return args.every(run);\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,GAAG,MAA0B;AACvD,QAAO,KAAK,MAAM,IAAI"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_runAnyoneMethods = require('./runAnyoneMethods-BnV5_696.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/exports/any.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks that at least one passed argument evaluates to a truthy value.
|
|
6
|
+
*/
|
|
7
|
+
function any(...args) {
|
|
8
|
+
return args.some(require_runAnyoneMethods.run);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
Object.defineProperty(exports, 'any', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return any;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=any-7W0t-5U9.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any-7W0t-5U9.cjs","names":["run"],"sources":["../src/exports/any.ts"],"sourcesContent":["import run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at least one passed argument evaluates to a truthy value.\n */\nexport default function any(...args: unknown[]): boolean {\n return args.some(run);\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,GAAG,MAA0B;AACvD,QAAO,KAAK,KAAKA,6BAAI"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as run } from "./runAnyoneMethods-CiYJATON.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/any.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks that at least one passed argument evaluates to a truthy value.
|
|
6
|
+
*/
|
|
7
|
+
function any(...args) {
|
|
8
|
+
return args.some(run);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { any as t };
|
|
13
|
+
//# sourceMappingURL=any-Bu9n0b6b.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any-Bu9n0b6b.mjs","names":[],"sources":["../src/exports/any.ts"],"sourcesContent":["import run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at least one passed argument evaluates to a truthy value.\n */\nexport default function any(...args: unknown[]): boolean {\n return args.some(run);\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,GAAG,MAA0B;AACvD,QAAO,KAAK,KAAK,IAAI"}
|
package/dist/anyone.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require('./runAnyoneMethods-BnV5_696.cjs');
|
|
2
|
+
const require_all = require('./all-G56EfCZm.cjs');
|
|
3
|
+
const require_any = require('./any-7W0t-5U9.cjs');
|
|
4
|
+
const require_none = require('./none-BvnsAgF8.cjs');
|
|
5
|
+
const require_one = require('./one-C-TngTWp.cjs');
|
|
6
|
+
|
|
7
|
+
exports.all = require_all.all;
|
|
8
|
+
exports.any = require_any.any;
|
|
9
|
+
exports.none = require_none.none;
|
|
10
|
+
exports.one = require_one.one;
|
package/dist/anyone.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./runAnyoneMethods-CiYJATON.mjs";
|
|
2
|
+
import { t as all } from "./all-jZqtYMoF.mjs";
|
|
3
|
+
import { t as any } from "./any-Bu9n0b6b.mjs";
|
|
4
|
+
import { t as none } from "./none-BaiW3V_k.mjs";
|
|
5
|
+
import { t as one } from "./one-D5UWawb-.mjs";
|
|
6
|
+
|
|
7
|
+
export { all, any, none, one };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as run } from "./runAnyoneMethods-CiYJATON.mjs";
|
|
2
|
+
import { bindNot } from "vest-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/exports/none.ts
|
|
5
|
+
/**
|
|
6
|
+
* Checks that at none of the passed arguments evaluate to a truthy value.
|
|
7
|
+
*/
|
|
8
|
+
function none(...args) {
|
|
9
|
+
return args.every(bindNot(run));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { none as t };
|
|
14
|
+
//# sourceMappingURL=none-BaiW3V_k.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"none-BaiW3V_k.mjs","names":[],"sources":["../src/exports/none.ts"],"sourcesContent":["import { bindNot } from 'vest-utils';\n\nimport run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at none of the passed arguments evaluate to a truthy value.\n */\nexport default function none(...args: unknown[]): boolean {\n return args.every(bindNot(run));\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,KAAK,GAAG,MAA0B;AACxD,QAAO,KAAK,MAAM,QAAQ,IAAI,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_runAnyoneMethods = require('./runAnyoneMethods-BnV5_696.cjs');
|
|
2
|
+
let vest_utils = require("vest-utils");
|
|
3
|
+
|
|
4
|
+
//#region src/exports/none.ts
|
|
5
|
+
/**
|
|
6
|
+
* Checks that at none of the passed arguments evaluate to a truthy value.
|
|
7
|
+
*/
|
|
8
|
+
function none(...args) {
|
|
9
|
+
return args.every((0, vest_utils.bindNot)(require_runAnyoneMethods.run));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
Object.defineProperty(exports, 'none', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return none;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=none-BvnsAgF8.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"none-BvnsAgF8.cjs","names":["run"],"sources":["../src/exports/none.ts"],"sourcesContent":["import { bindNot } from 'vest-utils';\n\nimport run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at none of the passed arguments evaluate to a truthy value.\n */\nexport default function none(...args: unknown[]): boolean {\n return args.every(bindNot(run));\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,KAAK,GAAG,MAA0B;AACxD,QAAO,KAAK,8BAAcA,6BAAI,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_runAnyoneMethods = require('./runAnyoneMethods-BnV5_696.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/exports/one.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks that at only one passed argument evaluates to a truthy value.
|
|
6
|
+
*/
|
|
7
|
+
function one(...args) {
|
|
8
|
+
let count = 0;
|
|
9
|
+
for (let i = 0; i < args.length; i++) {
|
|
10
|
+
if (require_runAnyoneMethods.run(args[i])) count++;
|
|
11
|
+
if (count > 1) return false;
|
|
12
|
+
}
|
|
13
|
+
return count === 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
Object.defineProperty(exports, 'one', {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return one;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=one-C-TngTWp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-C-TngTWp.cjs","names":["run"],"sources":["../src/exports/one.ts"],"sourcesContent":["import run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at only one passed argument evaluates to a truthy value.\n */\nexport default function one(...args: unknown[]): boolean {\n let count = 0;\n\n for (let i = 0; i < args.length; i++) {\n if (run(args[i])) {\n count++;\n }\n\n if (count > 1) {\n return false;\n }\n }\n\n return count === 1;\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,GAAG,MAA0B;CACvD,IAAI,QAAQ;AAEZ,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,MAAIA,6BAAI,KAAK,GAAG,CACd;AAGF,MAAI,QAAQ,EACV,QAAO;;AAIX,QAAO,UAAU"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as run } from "./runAnyoneMethods-CiYJATON.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/one.ts
|
|
4
|
+
/**
|
|
5
|
+
* Checks that at only one passed argument evaluates to a truthy value.
|
|
6
|
+
*/
|
|
7
|
+
function one(...args) {
|
|
8
|
+
let count = 0;
|
|
9
|
+
for (let i = 0; i < args.length; i++) {
|
|
10
|
+
if (run(args[i])) count++;
|
|
11
|
+
if (count > 1) return false;
|
|
12
|
+
}
|
|
13
|
+
return count === 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { one as t };
|
|
18
|
+
//# sourceMappingURL=one-D5UWawb-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-D5UWawb-.mjs","names":[],"sources":["../src/exports/one.ts"],"sourcesContent":["import run from '../runner/runAnyoneMethods';\n\n/**\n * Checks that at only one passed argument evaluates to a truthy value.\n */\nexport default function one(...args: unknown[]): boolean {\n let count = 0;\n\n for (let i = 0; i < args.length; i++) {\n if (run(args[i])) {\n count++;\n }\n\n if (count > 1) {\n return false;\n }\n }\n\n return count === 1;\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,GAAG,MAA0B;CACvD,IAAI,QAAQ;AAEZ,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,MAAI,IAAI,KAAK,GAAG,CACd;AAGF,MAAI,QAAQ,EACV,QAAO;;AAIX,QAAO,UAAU"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
let vest_utils = require("vest-utils");
|
|
2
|
+
|
|
3
|
+
//#region src/runner/runAnyoneMethods.ts
|
|
4
|
+
/**
|
|
5
|
+
* Accepts a value or a function, and coerces it into a boolean value
|
|
6
|
+
*/
|
|
7
|
+
function run(arg) {
|
|
8
|
+
if ((0, vest_utils.isFunction)(arg)) try {
|
|
9
|
+
return check(arg());
|
|
10
|
+
} catch (err) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return check(arg);
|
|
14
|
+
}
|
|
15
|
+
function check(value) {
|
|
16
|
+
return Array.isArray(value) ? true : value != false && Boolean(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
Object.defineProperty(exports, 'run', {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return run;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=runAnyoneMethods-BnV5_696.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runAnyoneMethods-BnV5_696.cjs","names":[],"sources":["../src/runner/runAnyoneMethods.ts"],"sourcesContent":["import { isFunction } from 'vest-utils';\n\n/**\n * Accepts a value or a function, and coerces it into a boolean value\n */\nexport default function run(arg: unknown): boolean {\n if (isFunction(arg)) {\n try {\n return check(arg());\n } catch (err) {\n return false;\n }\n }\n\n return check(arg);\n}\n\nfunction check(value: unknown): boolean {\n // We use abstract equality intentionally here. This enables falsy valueOf support.\n return Array.isArray(value) ? true : value != false && Boolean(value);\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,KAAuB;AACjD,gCAAe,IAAI,CACjB,KAAI;AACF,SAAO,MAAM,KAAK,CAAC;UACZ,KAAK;AACZ,SAAO;;AAIX,QAAO,MAAM,IAAI;;AAGnB,SAAS,MAAM,OAAyB;AAEtC,QAAO,MAAM,QAAQ,MAAM,GAAG,OAAO,SAAS,SAAS,QAAQ,MAAM"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isFunction } from "vest-utils";
|
|
2
|
+
|
|
3
|
+
//#region src/runner/runAnyoneMethods.ts
|
|
4
|
+
/**
|
|
5
|
+
* Accepts a value or a function, and coerces it into a boolean value
|
|
6
|
+
*/
|
|
7
|
+
function run(arg) {
|
|
8
|
+
if (isFunction(arg)) try {
|
|
9
|
+
return check(arg());
|
|
10
|
+
} catch (err) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return check(arg);
|
|
14
|
+
}
|
|
15
|
+
function check(value) {
|
|
16
|
+
return Array.isArray(value) ? true : value != false && Boolean(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { run as t };
|
|
21
|
+
//# sourceMappingURL=runAnyoneMethods-CiYJATON.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runAnyoneMethods-CiYJATON.mjs","names":[],"sources":["../src/runner/runAnyoneMethods.ts"],"sourcesContent":["import { isFunction } from 'vest-utils';\n\n/**\n * Accepts a value or a function, and coerces it into a boolean value\n */\nexport default function run(arg: unknown): boolean {\n if (isFunction(arg)) {\n try {\n return check(arg());\n } catch (err) {\n return false;\n }\n }\n\n return check(arg);\n}\n\nfunction check(value: unknown): boolean {\n // We use abstract equality intentionally here. This enables falsy valueOf support.\n return Array.isArray(value) ? true : value != false && Boolean(value);\n}\n"],"mappings":";;;;;;AAKA,SAAwB,IAAI,KAAuB;AACjD,KAAI,WAAW,IAAI,CACjB,KAAI;AACF,SAAO,MAAM,KAAK,CAAC;UACZ,KAAK;AACZ,SAAO;;AAIX,QAAO,MAAM,IAAI;;AAGnB,SAAS,MAAM,OAAyB;AAEtC,QAAO,MAAM,QAAQ,MAAM,GAAG,OAAO,SAAS,SAAS,QAAQ,MAAM"}
|
package/none/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"exports": {
|
|
3
|
+
".": {
|
|
4
|
+
"default": "../dist/exports/none.mjs",
|
|
5
|
+
"import": "../dist/exports/none.mjs",
|
|
6
|
+
"require": "../dist/exports/none.cjs",
|
|
7
|
+
"types": "../types/exports/none.d.mts"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"main": "../dist/exports/none.cjs",
|
|
11
|
+
"module": "../dist/exports/none.mjs",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"types": "../types/exports/none.d.mts"
|
|
7
14
|
}
|
package/one/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"exports": {
|
|
3
|
+
".": {
|
|
4
|
+
"default": "../dist/exports/one.mjs",
|
|
5
|
+
"import": "../dist/exports/one.mjs",
|
|
6
|
+
"require": "../dist/exports/one.cjs",
|
|
7
|
+
"types": "../types/exports/one.d.mts"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"main": "../dist/exports/one.cjs",
|
|
11
|
+
"module": "../dist/exports/one.mjs",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"types": "../types/exports/one.d.mts"
|
|
7
14
|
}
|