anyone 0.0.7 → 2.0.0-dev-031d95

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/LICENSE +2 -2
  3. package/README.md +37 -37
  4. package/all/package.json +7 -0
  5. package/any/package.json +7 -0
  6. package/dist/cjs/all.development.js +37 -0
  7. package/dist/cjs/all.js +7 -0
  8. package/dist/cjs/all.production.js +1 -0
  9. package/dist/cjs/any.development.js +37 -0
  10. package/dist/cjs/any.js +7 -0
  11. package/dist/cjs/any.production.js +1 -0
  12. package/dist/cjs/anyone.development.js +94 -0
  13. package/dist/cjs/anyone.js +7 -0
  14. package/dist/cjs/anyone.production.js +1 -0
  15. package/dist/cjs/none.development.js +47 -0
  16. package/dist/cjs/none.js +7 -0
  17. package/dist/cjs/none.production.js +1 -0
  18. package/dist/cjs/one.development.js +46 -0
  19. package/dist/cjs/one.js +7 -0
  20. package/dist/cjs/one.production.js +1 -0
  21. package/dist/cjs/package.json +1 -0
  22. package/dist/es/all.development.js +35 -0
  23. package/dist/es/all.production.js +1 -0
  24. package/dist/es/any.development.js +35 -0
  25. package/dist/es/any.production.js +1 -0
  26. package/dist/es/anyone.development.js +87 -0
  27. package/dist/es/anyone.production.js +1 -0
  28. package/dist/es/none.development.js +45 -0
  29. package/dist/es/none.production.js +1 -0
  30. package/dist/es/one.development.js +44 -0
  31. package/dist/es/one.production.js +1 -0
  32. package/dist/es/package.json +1 -0
  33. package/dist/umd/all.development.js +43 -0
  34. package/dist/umd/all.production.js +1 -0
  35. package/dist/umd/any.development.js +43 -0
  36. package/dist/umd/any.production.js +1 -0
  37. package/dist/umd/anyone.development.js +100 -0
  38. package/dist/umd/anyone.production.js +1 -0
  39. package/dist/umd/none.development.js +53 -0
  40. package/dist/umd/none.production.js +1 -0
  41. package/dist/umd/one.development.js +52 -0
  42. package/dist/umd/one.production.js +1 -0
  43. package/none/package.json +7 -0
  44. package/one/package.json +7 -0
  45. package/package.json +156 -30
  46. package/tsconfig.json +8 -0
  47. package/types/all.d.ts +5 -0
  48. package/types/any.d.ts +5 -0
  49. package/types/anyone.d.ts +17 -0
  50. package/types/none.d.ts +5 -0
  51. package/types/one.d.ts +5 -0
  52. package/.eslintignore +0 -5
  53. package/.eslintrc.js +0 -31
  54. package/.travis.yml +0 -17
  55. package/all/index.js +0 -1
  56. package/all/index.min.js +0 -1
  57. package/any/index.js +0 -1
  58. package/any/index.min.js +0 -1
  59. package/dist/index.js +0 -1
  60. package/dist/index.min.js +0 -1
  61. package/none/index.js +0 -1
  62. package/none/index.min.js +0 -1
  63. package/one/index.js +0 -1
  64. package/one/index.min.js +0 -1
  65. package/rollup.config.js +0 -51
  66. package/src/index.js +0 -3
  67. package/src/lib/constants/index.js +0 -16
  68. package/src/lib/run/index.js +0 -21
  69. package/src/lib/run/spec.js +0 -31
  70. package/src/methods/all/index.js +0 -10
  71. package/src/methods/all/spec.js +0 -49
  72. package/src/methods/any/index.js +0 -10
  73. package/src/methods/any/spec.js +0 -63
  74. package/src/methods/index.js +0 -4
  75. package/src/methods/none/index.js +0 -10
  76. package/src/methods/none/spec.js +0 -63
  77. package/src/methods/one/index.js +0 -28
  78. package/src/methods/one/spec.js +0 -61
package/package.json CHANGED
@@ -1,40 +1,166 @@
1
1
  {
2
2
  "name": "anyone",
3
- "version": "0.0.7",
4
- "description": "Anyone",
5
- "main": "dist/index.min.js",
3
+ "license": "MIT",
4
+ "main": "./dist/cjs/anyone.js",
5
+ "types": "./types/anyone.d.ts",
6
+ "version": "2.0.0-dev-031d95",
7
+ "author": "ealush",
6
8
  "scripts": {
7
- "test": "jest",
8
- "lint": "eslint",
9
- "pretest": "npm run build",
10
- "build": "npx rollup --config rollup.config.js"
9
+ "test": "vx test",
10
+ "build": "vx build",
11
+ "release": "vx release"
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
+ "./": "./"
11
157
  },
12
158
  "repository": {
13
159
  "type": "git",
14
- "url": "git+https://github.com/ealush/anyone.git"
160
+ "url": "https://github.com/ealush/vest.git",
161
+ "directory": "packages/anyone"
15
162
  },
16
- "author": "ealush",
17
- "license": "MIT",
18
163
  "bugs": {
19
- "url": "https://github.com/ealush/anyone/issues"
20
- },
21
- "homepage": "https://github.com/ealush/anyone#readme",
22
- "devDependencies": {
23
- "@ampproject/rollup-plugin-closure-compiler": "^0.24.0",
24
- "@babel/cli": "^7.8.4",
25
- "@babel/core": "^7.9.0",
26
- "@babel/plugin-transform-object-assign": "^7.8.3",
27
- "@babel/preset-env": "^7.9.0",
28
- "@babel/preset-flow": "^7.0.0",
29
- "babel-eslint": "^10.0.2",
30
- "babel-jest": "^24.8.0",
31
- "eslint": "^6.1.0",
32
- "jest": "^24.8.0",
33
- "lodash": "^4.17.15",
34
- "rollup": "^1.19.4",
35
- "rollup-plugin-babel": "^4.4.0",
36
- "rollup-plugin-node-resolve": "^5.2.0",
37
- "rollup-plugin-replace": "^2.2.0",
38
- "rollup-plugin-terser": "^5.1.1"
164
+ "url": "https://github.com/ealush/vest.git/issues"
39
165
  }
40
166
  }
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "declarationMap": true,
5
+ "declarationDir": "./types",
6
+ "outDir": "./dist"
7
+ }
8
+ }
package/types/all.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks that at all passed arguments evaluate to a truthy value.
3
+ */
4
+ declare function all(...args: unknown[]): boolean;
5
+ export { all as default };
package/types/any.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks that at least one passed argument evaluates to a truthy value.
3
+ */
4
+ declare function any(...args: unknown[]): boolean;
5
+ export { any as default };
@@ -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 };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks that at none of the passed arguments evaluate to a truthy value.
3
+ */
4
+ declare function none(...args: unknown[]): boolean;
5
+ export { none as default };
package/types/one.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks that at only one passed argument evaluates to a truthy value.
3
+ */
4
+ declare function one(...args: unknown[]): boolean;
5
+ export { one as default };
package/.eslintignore DELETED
@@ -1,5 +0,0 @@
1
- dist/*
2
- none/*
3
- all/*
4
- any/*
5
- one/*
package/.eslintrc.js DELETED
@@ -1,31 +0,0 @@
1
- module.exports = {
2
- 'env': {
3
- 'es6': true,
4
- 'jest': true,
5
- 'node': true
6
- },
7
- 'extends': 'eslint:recommended',
8
- 'parserOptions': {
9
- 'ecmaVersion': 2018,
10
- 'sourceType': 'module'
11
- },
12
- 'rules': {
13
- 'indent': [
14
- 'error',
15
- 4
16
- ],
17
- 'quotes': [
18
- 'error',
19
- 'single'
20
- ],
21
- 'semi': [
22
- 'error',
23
- 'always'
24
- ],
25
- 'eqeqeq': [
26
- 'error',
27
- 'always'
28
- ],
29
- 'no-trailing-spaces': ["error", { "ignoreComments": true }],
30
- }
31
- };
package/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "12"
4
- cache: npm
5
-
6
- before_script:
7
- - yarn build
8
- - yarn eslint
9
-
10
- deploy:
11
- - provider: npm
12
- email: code@ealush.com
13
- skip_cleanup: true
14
- api_key: $NPM_TOKEN
15
- on:
16
- repo: ealush/n4s
17
- branch: master
package/all/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).all=n()}(this,(function(){var e=function(e){if("function"==typeof e)try{return n(e())}catch(e){return!1}return n(e)},n=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return r.every(e)}}));
package/all/index.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).all=n()}(this,(function(){var e=function(e){if("function"==typeof e)try{return n(e())}catch(e){return!1}return n(e)},n=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return r.every(e)}}));
package/any/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).any=n()}(this,(function(){var e=function(e){if("function"==typeof e)try{return n(e())}catch(e){return!1}return n(e)},n=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];return t.some(e)}}));
package/any/index.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).any=n()}(this,(function(){var e=function(e){if("function"==typeof e)try{return n(e())}catch(e){return!1}return n(e)},n=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];return t.some(e)}}));
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n=n||self).anyone=r()}(this,(function(){var n=function(n){if("function"==typeof n)try{return r(n())}catch(n){return!1}return r(n)},r=function(n){return!!Array.isArray(n)||0!=n&&!!n};return Object.freeze({__proto__:null,any:function(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.some(n)},all:function(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.every(n)},none:function(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.every((function(r){return!n(r)}))},one:function(){for(var r=0,e=0;e<arguments.length;e++)if(n(0>e||arguments.length<=e?void 0:arguments[e])&&r++,1<r)return!1;return 1===r}})}));
package/dist/index.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n=n||self).anyone=r()}(this,(function(){var n=function(n){if("function"==typeof n)try{return r(n())}catch(n){return!1}return r(n)},r=function(n){return!!Array.isArray(n)||0!=n&&!!n};return Object.freeze({__proto__:null,any:function(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.some(n)},all:function(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.every(n)},none:function(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.every((function(r){return!n(r)}))},one:function(){for(var r=0,e=0;e<arguments.length;e++)if(n(0>e||arguments.length<=e?void 0:arguments[e])&&r++,1<r)return!1;return 1===r}})}));
package/none/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).none=n()}(this,(function(){var e=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return r.every((function(n){e:{if("function"==typeof n)try{var r=e(n());break e}catch(e){r=!1;break e}r=e(n)}return!r}))}}));
package/none/index.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).none=n()}(this,(function(){var e=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return r.every((function(n){e:{if("function"==typeof n)try{var r=e(n());break e}catch(e){r=!1;break e}r=e(n)}return!r}))}}));
package/one/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).one=n()}(this,(function(){var e=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=0,t=0;t<arguments.length;t++){e:{var r=0>t||arguments.length<=t?void 0:arguments[t];if("function"==typeof r)try{var f=e(r());break e}catch(e){f=!1;break e}f=e(r)}if(f&&n++,1<n)return!1}return 1===n}}));
package/one/index.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).one=n()}(this,(function(){var e=function(e){return!!Array.isArray(e)||0!=e&&!!e};return function(){for(var n=0,t=0;t<arguments.length;t++){e:{var r=0>t||arguments.length<=t?void 0:arguments[t];if("function"==typeof r)try{var f=e(r());break e}catch(e){f=!1;break e}f=e(r)}if(f&&n++,1<n)return!1}return 1===n}}));
package/rollup.config.js DELETED
@@ -1,51 +0,0 @@
1
- import path from 'path';
2
- import resolve from 'rollup-plugin-node-resolve';
3
- import compiler from '@ampproject/rollup-plugin-closure-compiler';
4
- import babel from 'rollup-plugin-babel';
5
- import { terser } from 'rollup-plugin-terser';
6
-
7
- const DEFAULT_FORMAT = 'umd';
8
- const FOLDER_NAME_METHODS = 'methods';
9
- const LIBRARY_NAME_ANYONE = 'anyone';
10
- const LIBRARY_NAME_ANY = 'any';
11
- const LIBRARY_NAME_ONE = 'one';
12
- const LIBRARY_NAME_ALL = 'all';
13
- const LIBRARY_NAME_NONE = 'none';
14
-
15
- const PLUGINS = [
16
- babel({
17
- exclude: /node_modules/,
18
- presets: [
19
- ['@babel/preset-env', { loose: true }],
20
- ],
21
- plugins: ['@babel/plugin-transform-object-assign']
22
- }),
23
- resolve(),
24
- compiler(),
25
- terser()
26
- ];
27
-
28
- const buildConfig = ({ format = DEFAULT_FORMAT, min = false, name = '' } = {}) => ({
29
- input: path.join('./src', name ? `${FOLDER_NAME_METHODS}/${name}` : '', 'index.js'),
30
- output: {
31
- name: name || LIBRARY_NAME_ANYONE,
32
- format,
33
- file: [
34
- `${name ? name : 'dist'}/index`,
35
- min && 'min',
36
- format !== DEFAULT_FORMAT && format,
37
- 'js'
38
- ].filter(Boolean).join('.')
39
- },
40
- plugins: PLUGINS
41
- });
42
-
43
- const genConfig = ({ name } = {}) => [ buildConfig({ name }), buildConfig({name, min: true}) ];
44
-
45
- export default [
46
- ...genConfig({ name: LIBRARY_NAME_ANY }),
47
- ...genConfig({ name: LIBRARY_NAME_ONE }),
48
- ...genConfig({ name: LIBRARY_NAME_ALL }),
49
- ...genConfig({ name: LIBRARY_NAME_NONE }),
50
- ...genConfig()
51
- ];
package/src/index.js DELETED
@@ -1,3 +0,0 @@
1
- import * as methods from './methods';
2
-
3
- export default methods;
@@ -1,16 +0,0 @@
1
- export const FALSY_VALUES = [
2
- false,
3
- 0,
4
- null,
5
- undefined,
6
- '',
7
- NaN
8
- ];
9
-
10
- export const TRUTHY_VALUES = [
11
- true,
12
- 1,
13
- 'true',
14
- [],
15
- {}
16
- ];
@@ -1,21 +0,0 @@
1
- /**
2
- * Accepts a value or a function, and coerces it into a boolean value
3
- * @param {*|Function} [arg] Any expression or value
4
- * @return {Boolean}
5
- */
6
- const run = (arg) => {
7
-
8
- if (typeof arg === 'function') {
9
- try {
10
- return check(arg());
11
- } catch (err) {
12
- return false;
13
- }
14
- }
15
-
16
- return check(arg)
17
- };
18
-
19
- const check = (value) => Array.isArray(value) ? true : value != false && Boolean(value) // eslint-disable-line
20
-
21
- export default run;
@@ -1,31 +0,0 @@
1
- import { FALSY_VALUES, TRUTHY_VALUES } from '../constants';
2
- import run from '.';
3
-
4
- describe('lib/run', () => {
5
-
6
- describe('When value is falsy', () => {
7
- it.each([FALSY_VALUES])('Should return `false` ("%s")',
8
- (value) => expect(run(value)).toBe(false)
9
- );
10
- });
11
-
12
- describe('When value is truthy', () => {
13
- it.each([TRUTHY_VALUES])('Should return `true` ("%s")',
14
- (value) => expect(run(value)).toBe(true)
15
- );
16
- });
17
-
18
- describe('When value is a function', () => {
19
- describe('When value is falsy', () => {
20
- it.each([FALSY_VALUES])('Should return `false` ("%s")',
21
- (value) => expect(run(() => value)).toBe(false)
22
- );
23
- });
24
-
25
- describe('When value is truthy', () => {
26
- it.each([TRUTHY_VALUES])('Should return `true` ("%s")',
27
- (value) => expect(run(() => value)).toBe(true)
28
- );
29
- });
30
- });
31
- });
@@ -1,10 +0,0 @@
1
- import run from '../../lib/run';
2
-
3
- /**
4
- * Checks that at all passed arguments evaluate to a truthy value.
5
- * @param {[]*} [args] Any amount of values or expressions.
6
- * @returns {Boolean}
7
- */
8
- const all = (...args) => args.every(run);
9
-
10
- export default all;
@@ -1,49 +0,0 @@
1
- import { sample, random } from 'lodash';
2
- import { TRUTHY_VALUES, FALSY_VALUES } from '../../lib/constants';
3
- import any from '.';
4
-
5
- describe('methods/all', () => {
6
-
7
- describe('When only falsy values', () => {
8
- it('Should return false', () => {
9
- expect(
10
- any.apply(null,
11
- Array.from(
12
- { length: random(1, 10) },
13
- (_, i) => 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.apply(null,
24
- Array.from(
25
- { length: random(1, 10) },
26
- (_, i) => i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
27
- )
28
- )
29
- ).toBe(true);
30
- });
31
- });
32
-
33
- describe('When some truthy values', () => {
34
- it('Should return false', () => {
35
- expect(
36
- any.apply(null,
37
- [...Array.from(
38
- { length: random(1, 10) },
39
- (_, i) => i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
40
- ),
41
- ...Array.from(
42
- { length: random(1, 10) },
43
- (_, i) => i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
44
- )]
45
- )
46
- ).toBe(false);
47
- });
48
- });
49
- });
@@ -1,10 +0,0 @@
1
- import run from '../../lib/run';
2
-
3
- /**
4
- * Checks that at least one passed argument evaluates to a truthy value.
5
- * @param {[]*} [args] Any amount of values or expressions.
6
- * @returns {Boolean}
7
- */
8
- const any = (...args) => args.some(run);
9
-
10
- export default any;
@@ -1,63 +0,0 @@
1
- import { sample, random } from 'lodash';
2
- import { TRUTHY_VALUES, FALSY_VALUES } from '../../lib/constants';
3
- import any from '.';
4
-
5
- describe('methods/any', () => {
6
-
7
- describe('When only falsy values', () => {
8
- it('Should return false', () => {
9
- expect(
10
- any.apply(null,
11
- Array.from(
12
- { length: random(1, 10) },
13
- (_, i) => 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.apply(null,
24
- Array.from(
25
- { length: random(1, 10) },
26
- (_, i) => i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
27
- )
28
- )
29
- ).toBe(true);
30
- });
31
- });
32
-
33
- describe('When one truthy value', () => {
34
- it('Should return true', () => {
35
- expect(
36
- any.apply(null,
37
- [...Array.from(
38
- { length: random(1, 10) },
39
- (_, i) => i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
40
- ),
41
- sample(TRUTHY_VALUES)]
42
- )
43
- ).toBe(true);
44
- });
45
- });
46
-
47
- describe('When some truthy values', () => {
48
- it('Should return true', () => {
49
- expect(
50
- any.apply(null,
51
- [...Array.from(
52
- { length: random(1, 10) },
53
- (_, i) => i % 2 === 0 ? sample(FALSY_VALUES) : sample(FALSY_VALUES)
54
- ),
55
- ...Array.from(
56
- { length: random(1, 10) },
57
- (_, i) => i % 2 === 0 ? sample(TRUTHY_VALUES) : sample(TRUTHY_VALUES)
58
- )]
59
- )
60
- ).toBe(true);
61
- });
62
- });
63
- });
@@ -1,4 +0,0 @@
1
- export { default as any } from './any';
2
- export { default as all } from './all';
3
- export { default as none } from './none';
4
- export { default as one } from './one';
@@ -1,10 +0,0 @@
1
- import run from '../../lib/run';
2
-
3
- /**
4
- * Checks that at none of the passed arguments evaluate to a truthy value.
5
- * @param {[]*} [args] Any amount of values or expressions.
6
- * @returns {Boolean}
7
- */
8
- const none = (...args) => args.every((arg) => !run(arg));
9
-
10
- export default none;