util-nonempty 4.0.7 → 4.0.10
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 +4 -1
- package/dist/util-nonempty.esm.js +2 -20
- package/dist/util-nonempty.umd.js +2 -2
- package/examples/_quickTake.js +1 -0
- package/package.json +22 -75
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ If you need a legacy version which works with `require`, use version 3.1.0
|
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
import { strict as assert } from "assert";
|
|
41
|
+
|
|
41
42
|
import { nonEmpty } from "util-nonempty";
|
|
42
43
|
|
|
43
44
|
assert.equal(nonEmpty("z"), true);
|
|
@@ -58,7 +59,7 @@ assert.equal(nonEmpty(f), false);
|
|
|
58
59
|
|
|
59
60
|
## Documentation
|
|
60
61
|
|
|
61
|
-
Please [visit codsen.com](https://codsen.com/os/util-nonempty/) for a full description of the API
|
|
62
|
+
Please [visit codsen.com](https://codsen.com/os/util-nonempty/) for a full description of the API.
|
|
62
63
|
|
|
63
64
|
## Contributing
|
|
64
65
|
|
|
@@ -70,4 +71,6 @@ MIT License
|
|
|
70
71
|
|
|
71
72
|
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
72
73
|
|
|
74
|
+
|
|
73
75
|
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
76
|
+
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name util-nonempty
|
|
3
3
|
* @fileoverview Is the input (plain object, array, string or whatever) not empty?
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/util-nonempty/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
var version$1 = "4.0.7";
|
|
13
|
-
|
|
14
|
-
const version = version$1;
|
|
15
|
-
function nonEmpty(input) {
|
|
16
|
-
if (input == null) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (Array.isArray(input) || typeof input === "string") {
|
|
20
|
-
return !!input.length;
|
|
21
|
-
}
|
|
22
|
-
if (isPlainObject(input)) {
|
|
23
|
-
return !!Object.keys(input).length;
|
|
24
|
-
}
|
|
25
|
-
return typeof input === "number";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { nonEmpty, version };
|
|
10
|
+
import n from"lodash.isplainobject";var t="4.0.10";var l=t;function p(e){return e==null?!1:Array.isArray(e)||typeof e=="string"?!!e.length:n(e)?!!Object.keys(e).length:typeof e=="number"}export{p as nonEmpty,l as version};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name util-nonempty
|
|
3
3
|
* @fileoverview Is the input (plain object, array, string or whatever) not empty?
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/util-nonempty/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var utilNonempty=(()=>{var f=Object.create;var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var c=t=>o(t,"__esModule",{value:!0});var h=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),v=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},i=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of j(e))!g.call(t,n)&&(r||n!=="default")&&o(t,n,{get:()=>e[n],enumerable:!(s=b(e,n))||s.enumerable});return t},O=(t,e)=>i(c(o(t!=null?f(m(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),x=(t=>(e,r)=>t&&t.get(e)||(r=i(c({}),e,1),t&&t.set(e,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var u=h((V,a)=>{var P="[object Object]";function k(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function S(t,e){return function(r){return t(e(r))}}var w=Function.prototype,p=Object.prototype,l=w.toString,T=p.hasOwnProperty,A=l.call(Object),C=p.toString,D=S(Object.getPrototypeOf,Object);function E(t){return!!t&&typeof t=="object"}function I(t){if(!E(t)||C.call(t)!=P||k(t))return!1;var e=D(t);if(e===null)return!0;var r=T.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&l.call(r)==A}a.exports=I});var L={};v(L,{nonEmpty:()=>H,version:()=>F});var d=O(u(),1);var y="4.0.10";var F=y;function H(t){return t==null?!1:Array.isArray(t)||typeof t=="string"?!!t.length:(0,d.default)(t)?!!Object.keys(t).length:typeof t=="number"}return x(L);})();
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "util-nonempty",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.10",
|
|
4
4
|
"description": "Is the input (plain object, array, string or whatever) not empty?",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -30,93 +30,40 @@
|
|
|
30
30
|
},
|
|
31
31
|
"types": "types/index.d.ts",
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"republish": "npm publish || :",
|
|
46
|
-
"tap": "tap",
|
|
47
|
-
"pretest": "npm run build",
|
|
48
|
-
"test": "npm run test:ci && npm run perf",
|
|
49
|
-
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
50
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
51
|
-
"tsc": "tsc",
|
|
52
|
-
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
33
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
34
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
35
|
+
"dts": "rollup -c",
|
|
36
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
37
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
38
|
+
"letspublish": "yarn publish || :",
|
|
39
|
+
"lint": "eslint . --fix",
|
|
40
|
+
"perf": "node perf/check.js",
|
|
41
|
+
"prepare": "echo 'ready'",
|
|
42
|
+
"pretest": "yarn run lect && yarn run build",
|
|
43
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
44
|
+
"unit": "uvu test"
|
|
53
45
|
},
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
48
|
+
},
|
|
49
|
+
"c8": {
|
|
50
|
+
"check-coverage": true,
|
|
51
|
+
"exclude": [
|
|
52
|
+
"**/test/**/*.*"
|
|
60
53
|
],
|
|
61
|
-
"
|
|
54
|
+
"lines": 100
|
|
62
55
|
},
|
|
63
56
|
"lect": {
|
|
64
57
|
"licence": {
|
|
65
58
|
"extras": [
|
|
66
59
|
""
|
|
67
60
|
]
|
|
68
|
-
},
|
|
69
|
-
"req": "{ nonEmpty }",
|
|
70
|
-
"various": {
|
|
71
|
-
"devDependencies": [
|
|
72
|
-
"@types/lodash.isplainobject"
|
|
73
|
-
]
|
|
74
61
|
}
|
|
75
62
|
},
|
|
76
63
|
"dependencies": {
|
|
77
|
-
"@babel/runtime": "^7.16.3",
|
|
78
64
|
"lodash.isplainobject": "^4.0.6"
|
|
79
65
|
},
|
|
80
66
|
"devDependencies": {
|
|
81
|
-
"@
|
|
82
|
-
"@babel/core": "^7.16.0",
|
|
83
|
-
"@babel/node": "^7.16.0",
|
|
84
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
85
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
86
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
87
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
88
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
89
|
-
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
90
|
-
"@babel/preset-env": "^7.16.4",
|
|
91
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
92
|
-
"@babel/register": "^7.16.0",
|
|
93
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
94
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
95
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
96
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
97
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
98
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
99
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
100
|
-
"@types/lodash.isplainobject": "^4.0.6",
|
|
101
|
-
"@types/node": "^16.11.10",
|
|
102
|
-
"@types/tap": "^15.0.5",
|
|
103
|
-
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
104
|
-
"@typescript-eslint/parser": "^5.5.0",
|
|
105
|
-
"core-js": "^3.19.2",
|
|
106
|
-
"cross-env": "^7.0.3",
|
|
107
|
-
"eslint": "^8.3.0",
|
|
108
|
-
"lect": "^0.18.7",
|
|
109
|
-
"rollup": "^2.60.1",
|
|
110
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
111
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
112
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
113
|
-
"rollup-plugin-dts": "^4.0.1",
|
|
114
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
115
|
-
"tap": "^15.1.5",
|
|
116
|
-
"tslib": "^2.3.1",
|
|
117
|
-
"typescript": "^4.5.2"
|
|
118
|
-
},
|
|
119
|
-
"engines": {
|
|
120
|
-
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
67
|
+
"@types/lodash.isplainobject": "^4.0.6"
|
|
121
68
|
}
|
|
122
69
|
}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/examples/api.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"_quickTake.js":{"title":"Quick Take","content":"import { strict as assert } from \"assert\";\nimport { nonEmpty } from \"util-nonempty\";\n\nassert.equal(nonEmpty(\"z\"), true);\nassert.equal(nonEmpty(\"\"), false);\nassert.equal(nonEmpty([\"a\"]), true);\nassert.equal(nonEmpty([123]), true);\nassert.equal(nonEmpty([[[[[[[[[[[]]]]]]]]]]]), true);\nassert.equal(nonEmpty({ a: \"\" }), true);\nassert.equal(nonEmpty({ a: \"a\" }), true);\nassert.equal(nonEmpty({}), false);\n\nconst f = () => {\n return \"z\";\n};\nassert.equal(nonEmpty(f), false);\n// (answer is instantly false if input is not array, plain object or string)"}}
|