anyone 0.1.1-dev-c9788a → 1.0.2-dev-afe5de
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 +33 -30
- package/README.md +4 -0
- package/all/package.json +9 -0
- package/any/package.json +9 -0
- package/dist/cjs/all.js +7 -0
- package/dist/cjs/any.js +7 -0
- package/dist/cjs/anyone.development.js +11 -14
- package/dist/cjs/anyone.js +7 -0
- package/dist/cjs/anyone.production.js +1 -1
- package/dist/cjs/none.js +7 -0
- package/dist/cjs/one.development.js +1 -4
- package/dist/cjs/one.js +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/es/anyone.development.js +11 -14
- package/dist/es/anyone.production.js +1 -1
- package/dist/es/one.development.js +1 -4
- package/dist/es/package.json +1 -0
- package/dist/umd/anyone.development.js +11 -14
- package/dist/umd/anyone.production.js +1 -1
- package/dist/umd/one.development.js +1 -4
- package/none/package.json +9 -0
- package/one/package.json +9 -0
- package/package.json +159 -8
- package/tsconfig.json +8 -0
- package/types/all.d.ts +5 -0
- package/types/any.d.ts +5 -0
- package/types/anyone.d.ts +17 -0
- package/types/none.d.ts +5 -0
- package/types/one.d.ts +5 -0
- package/index.js +0 -7
- package/src/__tests__/all.test.ts +0 -46
- package/src/__tests__/any.test.ts +0 -59
- package/src/__tests__/anyoneTestValues.ts +0 -3
- package/src/__tests__/none.test.ts +0 -60
- package/src/__tests__/one.test.ts +0 -56
- package/src/__tests__/runAnyoneMethods.test.ts +0 -32
- package/src/anyone.ts +0 -4
- package/src/exports/all.ts +0 -8
- package/src/exports/any.ts +0 -8
- package/src/exports/none.ts +0 -10
- package/src/exports/one.ts +0 -24
- package/src/runner/runAnyoneMethods.ts +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -4,42 +4,45 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
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
|
-
## 0.
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
- 0103b38 lint: handling lint of all packages (ealush)
|
|
11
|
-
- .gitignore
|
|
12
|
-
- 49b6b84 Vest 4 Infra Setup (ealush)
|
|
7
|
+
## 2.0.0 - 2021-12-24
|
|
8
|
+
|
|
9
|
+
- Use named exports
|
|
13
10
|
|
|
14
11
|
## 0.1.21 - 2021-07-02
|
|
12
|
+
|
|
15
13
|
### Fixed and improved
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
14
|
+
|
|
15
|
+
- 33f4e46 release (undefined)
|
|
16
|
+
- 6fe40c7 better bundle (undefined)
|
|
17
|
+
- c6387ab before ts settings (undefined)
|
|
18
|
+
- c0e9708 generate correct d.ts file (undefined)
|
|
19
|
+
- 8e01b8e x (undefined)
|
|
20
|
+
- afb3960 x (undefined)
|
|
21
|
+
- e0a8463 add changelog support (undefined)
|
|
22
|
+
- cc46c38 current (undefined)
|
|
24
23
|
|
|
25
24
|
## 0.1.20 - 2021-07-02
|
|
25
|
+
|
|
26
26
|
### Fixed and improved
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
27
|
+
|
|
28
|
+
- 33f4e46 release (undefined)
|
|
29
|
+
- 6fe40c7 better bundle (undefined)
|
|
30
|
+
- c6387ab before ts settings (undefined)
|
|
31
|
+
- c0e9708 generate correct d.ts file (undefined)
|
|
32
|
+
- 8e01b8e x (undefined)
|
|
33
|
+
- afb3960 x (undefined)
|
|
34
|
+
- e0a8463 add changelog support (undefined)
|
|
35
|
+
- cc46c38 current (undefined)
|
|
35
36
|
|
|
36
37
|
## 0.1.19 - 2021-07-02
|
|
38
|
+
|
|
37
39
|
### Fixed and improved
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
40
|
+
|
|
41
|
+
- 33f4e46 release (undefined)
|
|
42
|
+
- 6fe40c7 better bundle (undefined)
|
|
43
|
+
- c6387ab before ts settings (undefined)
|
|
44
|
+
- c0e9708 generate correct d.ts file (undefined)
|
|
45
|
+
- 8e01b8e x (undefined)
|
|
46
|
+
- afb3960 x (undefined)
|
|
47
|
+
- e0a8463 add changelog support (undefined)
|
|
48
|
+
- cc46c38 current (undefined)
|
package/README.md
CHANGED
package/all/package.json
ADDED
package/any/package.json
ADDED
package/dist/cjs/all.js
ADDED
package/dist/cjs/any.js
ADDED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
function bindNot(fn) {
|
|
6
|
+
return function () {
|
|
7
|
+
var args = [];
|
|
8
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9
|
+
args[_i] = arguments[_i];
|
|
10
|
+
}
|
|
11
|
+
return !fn.apply(void 0, args);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
function isFunction(value) {
|
|
6
16
|
return typeof value === 'function';
|
|
7
17
|
}
|
|
@@ -47,16 +57,6 @@ function any() {
|
|
|
47
57
|
return args.some(run);
|
|
48
58
|
}
|
|
49
59
|
|
|
50
|
-
function bindNot(fn) {
|
|
51
|
-
return function () {
|
|
52
|
-
var args = [];
|
|
53
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
54
|
-
args[_i] = arguments[_i];
|
|
55
|
-
}
|
|
56
|
-
return !fn.apply(void 0, args);
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
60
|
/**
|
|
61
61
|
* Checks that at none of the passed arguments evaluate to a truthy value.
|
|
62
62
|
*/
|
|
@@ -85,10 +85,7 @@ function one() {
|
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
88
|
+
return count === 1;
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
exports.all = all;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function r(r){if(function(r){return"function"==typeof r}(r))try{return
|
|
1
|
+
"use strict";function r(r){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return!r.apply(void 0,n)}}function n(r){if(function(r){return"function"==typeof r}(r))try{return t(r())}catch(r){return!1}return t(r)}function t(r){return!!Array.isArray(r)||0!=r&&!!r}Object.defineProperty(exports,"__esModule",{value:!0}),exports.all=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return r.every(n)},exports.any=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return r.some(n)},exports.none=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.every(r(n))},exports.one=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var e=t=0;e<r.length;e++)if(n(r[e])&&t++,1<t)return!1;return 1===t};
|
package/dist/cjs/none.js
ADDED
package/dist/cjs/one.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
function bindNot(fn) {
|
|
2
|
+
return function () {
|
|
3
|
+
var args = [];
|
|
4
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5
|
+
args[_i] = arguments[_i];
|
|
6
|
+
}
|
|
7
|
+
return !fn.apply(void 0, args);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
function isFunction(value) {
|
|
2
12
|
return typeof value === 'function';
|
|
3
13
|
}
|
|
@@ -43,16 +53,6 @@ function any() {
|
|
|
43
53
|
return args.some(run);
|
|
44
54
|
}
|
|
45
55
|
|
|
46
|
-
function bindNot(fn) {
|
|
47
|
-
return function () {
|
|
48
|
-
var args = [];
|
|
49
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
50
|
-
args[_i] = arguments[_i];
|
|
51
|
-
}
|
|
52
|
-
return !fn.apply(void 0, args);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
56
|
/**
|
|
57
57
|
* Checks that at none of the passed arguments evaluate to a truthy value.
|
|
58
58
|
*/
|
|
@@ -81,10 +81,7 @@ function one() {
|
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
84
|
+
return count === 1;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
export { all, any, none, one };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(r){if("function"==typeof r)try{return
|
|
1
|
+
function r(r){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return!r.apply(void 0,n)}}function n(r){if("function"==typeof r)try{return t(r())}catch(r){return!1}return t(r)}function t(r){return!!Array.isArray(r)||0!=r&&!!r}function e(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return r.every(n)}function u(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return r.some(n)}function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.every(r(n))}function f(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var e=t=0;e<r.length;e++)if(n(r[e])&&t++,1<t)return!1;return 1===t}export{e as all,u as any,o as none,f as one};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.anyone = {}));
|
|
5
5
|
}(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
+
function bindNot(fn) {
|
|
8
|
+
return function () {
|
|
9
|
+
var args = [];
|
|
10
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
|
+
args[_i] = arguments[_i];
|
|
12
|
+
}
|
|
13
|
+
return !fn.apply(void 0, args);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
7
17
|
function isFunction(value) {
|
|
8
18
|
return typeof value === 'function';
|
|
9
19
|
}
|
|
@@ -49,16 +59,6 @@
|
|
|
49
59
|
return args.some(run);
|
|
50
60
|
}
|
|
51
61
|
|
|
52
|
-
function bindNot(fn) {
|
|
53
|
-
return function () {
|
|
54
|
-
var args = [];
|
|
55
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
56
|
-
args[_i] = arguments[_i];
|
|
57
|
-
}
|
|
58
|
-
return !fn.apply(void 0, args);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
62
|
/**
|
|
63
63
|
* Checks that at none of the passed arguments evaluate to a truthy value.
|
|
64
64
|
*/
|
|
@@ -87,10 +87,7 @@
|
|
|
87
87
|
return false;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
90
|
+
return count === 1;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
exports.all = all;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).anyone={})}(this,(function(n){function e(n){if("function"==typeof n)try{return
|
|
1
|
+
"use strict";!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).anyone={})}(this,(function(n){function e(n){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return!n.apply(void 0,e)}}function r(n){if("function"==typeof n)try{return t(n())}catch(n){return!1}return t(n)}function t(n){return!!Array.isArray(n)||0!=n&&!!n}n.all=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.every(r)},n.any=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.some(r)},n.none=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n.every(e(r))},n.one=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=e=0;t<n.length;t++)if(r(n[t])&&e++,1<e)return!1;return 1===e},Object.defineProperty(n,"__esModule",{value:!0})}));
|
package/one/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,17 +1,168 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anyone",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"main": "
|
|
5
|
-
"types": "types",
|
|
6
|
-
"
|
|
7
|
-
"dist",
|
|
8
|
-
"src"
|
|
9
|
-
],
|
|
10
|
-
"version": "0.1.1-dev-c9788a",
|
|
4
|
+
"main": "./dist/cjs/anyone.js",
|
|
5
|
+
"types": "./types/anyone.d.ts",
|
|
6
|
+
"version": "1.0.2-dev-afe5de",
|
|
11
7
|
"author": "ealush",
|
|
12
8
|
"scripts": {
|
|
13
9
|
"test": "vx test",
|
|
14
10
|
"build": "vx build",
|
|
15
11
|
"release": "vx release"
|
|
16
|
-
}
|
|
12
|
+
},
|
|
13
|
+
"module": "./dist/es/anyone.production.js",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./all": {
|
|
16
|
+
"production": {
|
|
17
|
+
"types": "./types/all.d.ts",
|
|
18
|
+
"browser": "./dist/es/all.production.js",
|
|
19
|
+
"umd": "./dist/umd/all.production.js",
|
|
20
|
+
"import": "./dist/es/all.production.js",
|
|
21
|
+
"require": "./dist/cjs/all.production.js",
|
|
22
|
+
"node": "./dist/cjs/all.production.js",
|
|
23
|
+
"module": "./dist/es/all.production.js",
|
|
24
|
+
"default": "./dist/cjs/all.production.js"
|
|
25
|
+
},
|
|
26
|
+
"development": {
|
|
27
|
+
"types": "./types/all.d.ts",
|
|
28
|
+
"browser": "./dist/es/all.development.js",
|
|
29
|
+
"umd": "./dist/umd/all.development.js",
|
|
30
|
+
"import": "./dist/es/all.development.js",
|
|
31
|
+
"require": "./dist/cjs/all.development.js",
|
|
32
|
+
"node": "./dist/cjs/all.development.js",
|
|
33
|
+
"module": "./dist/es/all.development.js",
|
|
34
|
+
"default": "./dist/cjs/all.development.js"
|
|
35
|
+
},
|
|
36
|
+
"types": "./types/all.d.ts",
|
|
37
|
+
"browser": "./dist/es/all.production.js",
|
|
38
|
+
"umd": "./dist/umd/all.production.js",
|
|
39
|
+
"import": "./dist/es/all.production.js",
|
|
40
|
+
"require": "./dist/cjs/all.production.js",
|
|
41
|
+
"node": "./dist/cjs/all.production.js",
|
|
42
|
+
"module": "./dist/es/all.production.js",
|
|
43
|
+
"default": "./dist/cjs/all.production.js"
|
|
44
|
+
},
|
|
45
|
+
"./any": {
|
|
46
|
+
"production": {
|
|
47
|
+
"types": "./types/any.d.ts",
|
|
48
|
+
"browser": "./dist/es/any.production.js",
|
|
49
|
+
"umd": "./dist/umd/any.production.js",
|
|
50
|
+
"import": "./dist/es/any.production.js",
|
|
51
|
+
"require": "./dist/cjs/any.production.js",
|
|
52
|
+
"node": "./dist/cjs/any.production.js",
|
|
53
|
+
"module": "./dist/es/any.production.js",
|
|
54
|
+
"default": "./dist/cjs/any.production.js"
|
|
55
|
+
},
|
|
56
|
+
"development": {
|
|
57
|
+
"types": "./types/any.d.ts",
|
|
58
|
+
"browser": "./dist/es/any.development.js",
|
|
59
|
+
"umd": "./dist/umd/any.development.js",
|
|
60
|
+
"import": "./dist/es/any.development.js",
|
|
61
|
+
"require": "./dist/cjs/any.development.js",
|
|
62
|
+
"node": "./dist/cjs/any.development.js",
|
|
63
|
+
"module": "./dist/es/any.development.js",
|
|
64
|
+
"default": "./dist/cjs/any.development.js"
|
|
65
|
+
},
|
|
66
|
+
"types": "./types/any.d.ts",
|
|
67
|
+
"browser": "./dist/es/any.production.js",
|
|
68
|
+
"umd": "./dist/umd/any.production.js",
|
|
69
|
+
"import": "./dist/es/any.production.js",
|
|
70
|
+
"require": "./dist/cjs/any.production.js",
|
|
71
|
+
"node": "./dist/cjs/any.production.js",
|
|
72
|
+
"module": "./dist/es/any.production.js",
|
|
73
|
+
"default": "./dist/cjs/any.production.js"
|
|
74
|
+
},
|
|
75
|
+
"./none": {
|
|
76
|
+
"production": {
|
|
77
|
+
"types": "./types/none.d.ts",
|
|
78
|
+
"browser": "./dist/es/none.production.js",
|
|
79
|
+
"umd": "./dist/umd/none.production.js",
|
|
80
|
+
"import": "./dist/es/none.production.js",
|
|
81
|
+
"require": "./dist/cjs/none.production.js",
|
|
82
|
+
"node": "./dist/cjs/none.production.js",
|
|
83
|
+
"module": "./dist/es/none.production.js",
|
|
84
|
+
"default": "./dist/cjs/none.production.js"
|
|
85
|
+
},
|
|
86
|
+
"development": {
|
|
87
|
+
"types": "./types/none.d.ts",
|
|
88
|
+
"browser": "./dist/es/none.development.js",
|
|
89
|
+
"umd": "./dist/umd/none.development.js",
|
|
90
|
+
"import": "./dist/es/none.development.js",
|
|
91
|
+
"require": "./dist/cjs/none.development.js",
|
|
92
|
+
"node": "./dist/cjs/none.development.js",
|
|
93
|
+
"module": "./dist/es/none.development.js",
|
|
94
|
+
"default": "./dist/cjs/none.development.js"
|
|
95
|
+
},
|
|
96
|
+
"types": "./types/none.d.ts",
|
|
97
|
+
"browser": "./dist/es/none.production.js",
|
|
98
|
+
"umd": "./dist/umd/none.production.js",
|
|
99
|
+
"import": "./dist/es/none.production.js",
|
|
100
|
+
"require": "./dist/cjs/none.production.js",
|
|
101
|
+
"node": "./dist/cjs/none.production.js",
|
|
102
|
+
"module": "./dist/es/none.production.js",
|
|
103
|
+
"default": "./dist/cjs/none.production.js"
|
|
104
|
+
},
|
|
105
|
+
"./one": {
|
|
106
|
+
"production": {
|
|
107
|
+
"types": "./types/one.d.ts",
|
|
108
|
+
"browser": "./dist/es/one.production.js",
|
|
109
|
+
"umd": "./dist/umd/one.production.js",
|
|
110
|
+
"import": "./dist/es/one.production.js",
|
|
111
|
+
"require": "./dist/cjs/one.production.js",
|
|
112
|
+
"node": "./dist/cjs/one.production.js",
|
|
113
|
+
"module": "./dist/es/one.production.js",
|
|
114
|
+
"default": "./dist/cjs/one.production.js"
|
|
115
|
+
},
|
|
116
|
+
"development": {
|
|
117
|
+
"types": "./types/one.d.ts",
|
|
118
|
+
"browser": "./dist/es/one.development.js",
|
|
119
|
+
"umd": "./dist/umd/one.development.js",
|
|
120
|
+
"import": "./dist/es/one.development.js",
|
|
121
|
+
"require": "./dist/cjs/one.development.js",
|
|
122
|
+
"node": "./dist/cjs/one.development.js",
|
|
123
|
+
"module": "./dist/es/one.development.js",
|
|
124
|
+
"default": "./dist/cjs/one.development.js"
|
|
125
|
+
},
|
|
126
|
+
"types": "./types/one.d.ts",
|
|
127
|
+
"browser": "./dist/es/one.production.js",
|
|
128
|
+
"umd": "./dist/umd/one.production.js",
|
|
129
|
+
"import": "./dist/es/one.production.js",
|
|
130
|
+
"require": "./dist/cjs/one.production.js",
|
|
131
|
+
"node": "./dist/cjs/one.production.js",
|
|
132
|
+
"module": "./dist/es/one.production.js",
|
|
133
|
+
"default": "./dist/cjs/one.production.js"
|
|
134
|
+
},
|
|
135
|
+
".": {
|
|
136
|
+
"development": {
|
|
137
|
+
"types": "./types/anyone.d.ts",
|
|
138
|
+
"browser": "./dist/es/anyone.development.js",
|
|
139
|
+
"umd": "./dist/umd/anyone.development.js",
|
|
140
|
+
"import": "./dist/es/anyone.development.js",
|
|
141
|
+
"require": "./dist/cjs/anyone.development.js",
|
|
142
|
+
"node": "./dist/cjs/anyone.development.js",
|
|
143
|
+
"module": "./dist/es/anyone.development.js",
|
|
144
|
+
"default": "./dist/cjs/anyone.development.js"
|
|
145
|
+
},
|
|
146
|
+
"types": "./types/anyone.d.ts",
|
|
147
|
+
"browser": "./dist/es/anyone.production.js",
|
|
148
|
+
"umd": "./dist/umd/anyone.production.js",
|
|
149
|
+
"import": "./dist/es/anyone.production.js",
|
|
150
|
+
"require": "./dist/cjs/anyone.production.js",
|
|
151
|
+
"node": "./dist/cjs/anyone.production.js",
|
|
152
|
+
"module": "./dist/es/anyone.production.js",
|
|
153
|
+
"default": "./dist/cjs/anyone.production.js"
|
|
154
|
+
},
|
|
155
|
+
"./package.json": "./package.json",
|
|
156
|
+
"./": "./"
|
|
157
|
+
},
|
|
158
|
+
"repository": {
|
|
159
|
+
"type": "git",
|
|
160
|
+
"url": "https://github.com/ealush/vest.git",
|
|
161
|
+
"directory": "packages/anyone"
|
|
162
|
+
},
|
|
163
|
+
"bugs": {
|
|
164
|
+
"url": "https://github.com/ealush/vest.git/issues"
|
|
165
|
+
},
|
|
166
|
+
"unpkg": "./dist/umd/anyone.production.js",
|
|
167
|
+
"jsdelivr": "./dist/umd/anyone.production.js"
|
|
17
168
|
}
|
package/tsconfig.json
ADDED
package/types/all.d.ts
ADDED
package/types/any.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks that at all passed arguments evaluate to a truthy value.
|
|
3
|
+
*/
|
|
4
|
+
declare function all(...args: unknown[]): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Checks that at least one passed argument evaluates to a truthy value.
|
|
7
|
+
*/
|
|
8
|
+
declare function any(...args: unknown[]): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Checks that at none of the passed arguments evaluate to a truthy value.
|
|
11
|
+
*/
|
|
12
|
+
declare function none(...args: unknown[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks that at only one passed argument evaluates to a truthy value.
|
|
15
|
+
*/
|
|
16
|
+
declare function one(...args: unknown[]): boolean;
|
|
17
|
+
export { all, any, none, one };
|
package/types/none.d.ts
ADDED
package/types/one.d.ts
ADDED
package/index.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { sample, random } from 'lodash';
|
|
2
|
-
|
|
3
|
-
import { TRUTHY_VALUES, FALSY_VALUES } from './anyoneTestValues';
|
|
4
|
-
|
|
5
|
-
import all from 'all';
|
|
6
|
-
|
|
7
|
-
describe('methods/all', () => {
|
|
8
|
-
describe('When only falsy values', () => {
|
|
9
|
-
it('Should return false', () => {
|
|
10
|
-
expect(
|
|
11
|
-
all(
|
|
12
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
13
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
14
|
-
)
|
|
15
|
-
)
|
|
16
|
-
).toBe(false);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('When only truthy values', () => {
|
|
21
|
-
it('Should return true', () => {
|
|
22
|
-
expect(
|
|
23
|
-
all(
|
|
24
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
25
|
-
i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
|
|
26
|
-
)
|
|
27
|
-
)
|
|
28
|
-
).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('When some truthy values', () => {
|
|
33
|
-
it('Should return false', () => {
|
|
34
|
-
expect(
|
|
35
|
-
all.apply(null, [
|
|
36
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
37
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
38
|
-
),
|
|
39
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
40
|
-
i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
|
|
41
|
-
),
|
|
42
|
-
])
|
|
43
|
-
).toBe(false);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { sample, random } from 'lodash';
|
|
2
|
-
|
|
3
|
-
import { TRUTHY_VALUES, FALSY_VALUES } from './anyoneTestValues';
|
|
4
|
-
|
|
5
|
-
import any from 'any';
|
|
6
|
-
|
|
7
|
-
describe('methods/any', () => {
|
|
8
|
-
describe('When only falsy values', () => {
|
|
9
|
-
it('Should return false', () => {
|
|
10
|
-
expect(
|
|
11
|
-
any(
|
|
12
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
13
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
14
|
-
)
|
|
15
|
-
)
|
|
16
|
-
).toBe(false);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('When only truthy values', () => {
|
|
21
|
-
it('Should return true', () => {
|
|
22
|
-
expect(
|
|
23
|
-
any(
|
|
24
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
25
|
-
i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
|
|
26
|
-
)
|
|
27
|
-
)
|
|
28
|
-
).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('When one truthy value', () => {
|
|
33
|
-
it('Should return true', () => {
|
|
34
|
-
expect(
|
|
35
|
-
any.apply(null, [
|
|
36
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
37
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
38
|
-
),
|
|
39
|
-
sample(TRUTHY_VALUES),
|
|
40
|
-
])
|
|
41
|
-
).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('When some truthy values', () => {
|
|
46
|
-
it('Should return true', () => {
|
|
47
|
-
expect(
|
|
48
|
-
any.apply(null, [
|
|
49
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
50
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
51
|
-
),
|
|
52
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
53
|
-
i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
|
|
54
|
-
),
|
|
55
|
-
])
|
|
56
|
-
).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { sample, random } from 'lodash';
|
|
2
|
-
|
|
3
|
-
import { TRUTHY_VALUES, FALSY_VALUES } from './anyoneTestValues';
|
|
4
|
-
|
|
5
|
-
import none from 'none';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
describe('methods/none', () => {
|
|
9
|
-
describe('When only falsy values', () => {
|
|
10
|
-
it('Should return true', () => {
|
|
11
|
-
expect(
|
|
12
|
-
none(
|
|
13
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
14
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
15
|
-
)
|
|
16
|
-
)
|
|
17
|
-
).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('When only truthy values', () => {
|
|
22
|
-
it('Should return false', () => {
|
|
23
|
-
expect(
|
|
24
|
-
none(
|
|
25
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
26
|
-
i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
|
|
27
|
-
)
|
|
28
|
-
)
|
|
29
|
-
).toBe(false);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe('When one truthy value', () => {
|
|
34
|
-
it('Should return false', () => {
|
|
35
|
-
expect(
|
|
36
|
-
none.apply(null, [
|
|
37
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
38
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
39
|
-
),
|
|
40
|
-
sample(TRUTHY_VALUES),
|
|
41
|
-
])
|
|
42
|
-
).toBe(false);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('When some truthy values', () => {
|
|
47
|
-
it('Should return false', () => {
|
|
48
|
-
expect(
|
|
49
|
-
none.apply(null, [
|
|
50
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
51
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
52
|
-
),
|
|
53
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
54
|
-
i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
|
|
55
|
-
),
|
|
56
|
-
])
|
|
57
|
-
).toBe(false);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { sample, random } from 'lodash';
|
|
2
|
-
|
|
3
|
-
import { TRUTHY_VALUES, FALSY_VALUES } from './anyoneTestValues';
|
|
4
|
-
|
|
5
|
-
import one from 'one';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
describe('methods/one', () => {
|
|
9
|
-
describe('When only falsy values', () => {
|
|
10
|
-
it('Should return false', () => {
|
|
11
|
-
expect(
|
|
12
|
-
one(
|
|
13
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
14
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
15
|
-
)
|
|
16
|
-
)
|
|
17
|
-
).toBe(false);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('When only truthy values', () => {
|
|
22
|
-
it('Should return false', () => {
|
|
23
|
-
expect(
|
|
24
|
-
one(
|
|
25
|
-
...Array.from({ length: random(2, 10) }, (_, i) =>
|
|
26
|
-
i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
|
|
27
|
-
)
|
|
28
|
-
)
|
|
29
|
-
).toBe(false);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe('When one truthy value', () => {
|
|
34
|
-
it('Should return true', () => {
|
|
35
|
-
expect(
|
|
36
|
-
one(
|
|
37
|
-
...Array.from({ length: random(1, 10) }, (_, i) =>
|
|
38
|
-
i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
|
|
39
|
-
),
|
|
40
|
-
sample(TRUTHY_VALUES)
|
|
41
|
-
)
|
|
42
|
-
).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('When some truthy values', () => {
|
|
47
|
-
it('Should return false', () => {
|
|
48
|
-
expect(
|
|
49
|
-
one(
|
|
50
|
-
...Array.from({ length: random(2, 10) }, () => sample(TRUTHY_VALUES)),
|
|
51
|
-
...Array.from({ length: random(1, 10) }, () => sample(FALSY_VALUES))
|
|
52
|
-
)
|
|
53
|
-
).toBe(false);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FALSY_VALUES, TRUTHY_VALUES } from './anyoneTestValues';
|
|
2
|
-
|
|
3
|
-
import run from 'runAnyoneMethods';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
describe('lib/run', () => {
|
|
7
|
-
describe('When value is falsy', () => {
|
|
8
|
-
it.each([FALSY_VALUES])('Should return `false` ("%s")', value =>
|
|
9
|
-
expect(run(value)).toBe(false)
|
|
10
|
-
);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
describe('When value is truthy', () => {
|
|
14
|
-
it.each([TRUTHY_VALUES])('Should return `true` ("%s")', value =>
|
|
15
|
-
expect(run(value)).toBe(true)
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe('When value is a function', () => {
|
|
20
|
-
describe('When value is falsy', () => {
|
|
21
|
-
it.each([FALSY_VALUES])('Should return `false` ("%s")', value =>
|
|
22
|
-
expect(run(() => value)).toBe(false)
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('When value is truthy', () => {
|
|
27
|
-
it.each([TRUTHY_VALUES])('Should return `true` ("%s")', value =>
|
|
28
|
-
expect(run(() => value)).toBe(true)
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
package/src/anyone.ts
DELETED
package/src/exports/all.ts
DELETED
package/src/exports/any.ts
DELETED
package/src/exports/none.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import bindNot from 'bindNot';
|
|
2
|
-
|
|
3
|
-
import run from 'runAnyoneMethods';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Checks that at none of the passed arguments evaluate to a truthy value.
|
|
7
|
-
*/
|
|
8
|
-
export default function none(...args: unknown[]): boolean {
|
|
9
|
-
return args.every(bindNot(run));
|
|
10
|
-
}
|
package/src/exports/one.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import run from 'runAnyoneMethods';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checks that at only one passed argument evaluates to a truthy value.
|
|
5
|
-
*/
|
|
6
|
-
export default function one(...args: unknown[]): boolean {
|
|
7
|
-
let count = 0;
|
|
8
|
-
|
|
9
|
-
for (let i = 0; i < args.length; i++) {
|
|
10
|
-
if (run(args[i])) {
|
|
11
|
-
count++;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (count > 1) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (count !== 1) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import isFunction from 'isFunction';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Accepts a value or a function, and coerces it into a boolean value
|
|
5
|
-
*/
|
|
6
|
-
export default function run(arg: unknown): boolean {
|
|
7
|
-
if (isFunction(arg)) {
|
|
8
|
-
try {
|
|
9
|
-
return check(arg());
|
|
10
|
-
} catch (err) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return check(arg);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function check(value: unknown): boolean {
|
|
19
|
-
// We use abstract equality intentionally here. This enables falsy valueOf support.
|
|
20
|
-
return Array.isArray(value) ? true : value != false && Boolean(value); // eslint-disable-line
|
|
21
|
-
}
|