ast-is-empty 3.0.4 → 3.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/CHANGELOG.md +0 -20
- package/LICENSE +1 -1
- package/README.md +4 -1
- package/dist/ast-is-empty.esm.js +2 -47
- package/dist/ast-is-empty.umd.js +2 -2
- package/examples/_quickTake.js +1 -0
- package/package.json +22 -79
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 3.0.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
15
|
-
|
|
16
|
-
### BREAKING CHANGES
|
|
17
|
-
|
|
18
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
19
|
-
|
|
20
|
-
## 3.0.1 (2021-09-13)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
25
|
-
|
|
26
6
|
## 3.0.0 (2021-09-09)
|
|
27
7
|
|
|
28
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ If you need a legacy version which works with `require`, use version 2.1.0
|
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
import { strict as assert } from "assert";
|
|
41
|
+
|
|
41
42
|
import { isEmpty } from "ast-is-empty";
|
|
42
43
|
|
|
43
44
|
assert.equal(
|
|
@@ -74,7 +75,7 @@ assert.equal(
|
|
|
74
75
|
|
|
75
76
|
## Documentation
|
|
76
77
|
|
|
77
|
-
Please [visit codsen.com](https://codsen.com/os/ast-is-empty/) for a full description of the API
|
|
78
|
+
Please [visit codsen.com](https://codsen.com/os/ast-is-empty/) for a full description of the API.
|
|
78
79
|
|
|
79
80
|
## Contributing
|
|
80
81
|
|
|
@@ -86,4 +87,6 @@ MIT License
|
|
|
86
87
|
|
|
87
88
|
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
88
89
|
|
|
90
|
+
|
|
89
91
|
<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">
|
|
92
|
+
|
package/dist/ast-is-empty.esm.js
CHANGED
|
@@ -1,55 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-is-empty
|
|
3
3
|
* @fileoverview Find out, is nested array/object/string/AST tree is empty
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-is-empty/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
var version$1 = "3.0.4";
|
|
13
|
-
|
|
14
|
-
const version = version$1;
|
|
15
|
-
function isEmpty(input) {
|
|
16
|
-
let i;
|
|
17
|
-
let len;
|
|
18
|
-
let res = true;
|
|
19
|
-
if (Array.isArray(input)) {
|
|
20
|
-
if (input.length === 0) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
for (i = 0, len = input.length; i < len; i++) {
|
|
24
|
-
res = isEmpty(input[i]);
|
|
25
|
-
if (res === null) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
if (!res) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
} else if (isObj(input)) {
|
|
33
|
-
if (Object.keys(input).length === 0) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
for (i = 0, len = Object.keys(input).length; i < len; i++) {
|
|
37
|
-
res = isEmpty(input[Object.keys(input)[i]]);
|
|
38
|
-
if (res === null) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
if (!res) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
} else if (typeof input === "string") {
|
|
46
|
-
if (input.length !== 0) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
return res;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { isEmpty, version };
|
|
10
|
+
import i from"lodash.isplainobject";var n="3.0.10";var d=n;function l(e){let s,r,t=!0;if(Array.isArray(e)){if(e.length===0)return!0;for(s=0,r=e.length;s<r;s++){if(t=l(e[s]),t===null)return null;if(!t)return!1}}else if(i(e)){if(Object.keys(e).length===0)return!0;for(s=0,r=Object.keys(e).length;s<r;s++){if(t=l(e[Object.keys(e)[s]]),t===null)return null;if(!t)return!1}}else if(typeof e=="string"){if(e.length!==0)return!1}else return null;return t}export{l as isEmpty,d as version};
|
package/dist/ast-is-empty.umd.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-is-empty
|
|
3
3
|
* @fileoverview Find out, is nested array/object/string/AST tree is empty
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-is-empty/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var astIsEmpty=(()=>{var b=Object.create;var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var c=e=>o(e,"__esModule",{value:!0});var O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),v=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of j(t))!h.call(e,n)&&(r||n!=="default")&&o(e,n,{get:()=>t[n],enumerable:!(s=m(t,n))||s.enumerable});return e},x=(e,t)=>l(c(o(e!=null?b(g(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),k=(e=>(t,r)=>e&&e.get(t)||(r=l(c({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var y=O((V,u)=>{var P="[object Object]";function S(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function T(e,t){return function(r){return e(t(r))}}var A=Function.prototype,a=Object.prototype,p=A.toString,w=a.hasOwnProperty,C=p.call(Object),D=a.toString,E=T(Object.getPrototypeOf,Object);function F(e){return!!e&&typeof e=="object"}function R(e){if(!F(e)||D.call(e)!=P||S(e))return!1;var t=E(e);if(t===null)return!0;var r=w.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&p.call(r)==C}u.exports=R});var L={};v(L,{isEmpty:()=>i,version:()=>I});var d=x(y(),1);var f="3.0.10";var I=f;function i(e){let t,r,s=!0;if(Array.isArray(e)){if(e.length===0)return!0;for(t=0,r=e.length;t<r;t++){if(s=i(e[t]),s===null)return null;if(!s)return!1}}else if((0,d.default)(e)){if(Object.keys(e).length===0)return!0;for(t=0,r=Object.keys(e).length;t<r;t++){if(s=i(e[Object.keys(e)[t]]),s===null)return null;if(!s)return!1}}else if(typeof e=="string"){if(e.length!==0)return!1}else return null;return s}return k(L);})();
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ast-is-empty",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Find out, is nested array/object/string/AST tree is empty",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -44,97 +44,40 @@
|
|
|
44
44
|
},
|
|
45
45
|
"types": "types/index.d.ts",
|
|
46
46
|
"scripts": {
|
|
47
|
-
"build": "
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
60
|
-
"republish": "npm publish || :",
|
|
61
|
-
"tap": "tap",
|
|
62
|
-
"pretest": "npm run build",
|
|
63
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
64
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
65
|
-
"tsc": "tsc",
|
|
66
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
|
|
47
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
48
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
49
|
+
"dts": "rollup -c",
|
|
50
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
51
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
52
|
+
"letspublish": "yarn publish || :",
|
|
53
|
+
"lint": "eslint . --fix",
|
|
54
|
+
"perf": "node perf/check.js",
|
|
55
|
+
"prepare": "echo 'ready'",
|
|
56
|
+
"pretest": "yarn run lect && yarn run build",
|
|
57
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
58
|
+
"unit": "uvu test"
|
|
67
59
|
},
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"--no-warnings",
|
|
76
|
-
"--experimental-loader",
|
|
77
|
-
"@istanbuljs/esm-loader-hook"
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
62
|
+
},
|
|
63
|
+
"c8": {
|
|
64
|
+
"check-coverage": true,
|
|
65
|
+
"exclude": [
|
|
66
|
+
"**/test/**/*.*"
|
|
78
67
|
],
|
|
79
|
-
"
|
|
68
|
+
"lines": 100
|
|
80
69
|
},
|
|
81
70
|
"lect": {
|
|
82
71
|
"licence": {
|
|
83
72
|
"extras": [
|
|
84
73
|
""
|
|
85
74
|
]
|
|
86
|
-
},
|
|
87
|
-
"req": "{ isEmpty }",
|
|
88
|
-
"various": {
|
|
89
|
-
"devDependencies": [
|
|
90
|
-
"@types/lodash.isplainobject"
|
|
91
|
-
]
|
|
92
75
|
}
|
|
93
76
|
},
|
|
94
77
|
"dependencies": {
|
|
95
|
-
"@babel/runtime": "^7.16.0",
|
|
96
78
|
"lodash.isplainobject": "^4.0.6"
|
|
97
79
|
},
|
|
98
80
|
"devDependencies": {
|
|
99
|
-
"@
|
|
100
|
-
"@babel/core": "^7.16.0",
|
|
101
|
-
"@babel/node": "^7.16.0",
|
|
102
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
103
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
104
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
105
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
106
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
107
|
-
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
108
|
-
"@babel/preset-env": "^7.16.0",
|
|
109
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
110
|
-
"@babel/register": "^7.16.0",
|
|
111
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
112
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
113
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
114
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
115
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
116
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
117
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
118
|
-
"@types/lodash.isplainobject": "^4.0.6",
|
|
119
|
-
"@types/node": "^16.11.6",
|
|
120
|
-
"@types/tap": "^15.0.5",
|
|
121
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
122
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
123
|
-
"core-js": "^3.19.1",
|
|
124
|
-
"cross-env": "^7.0.3",
|
|
125
|
-
"eslint": "^8.1.0",
|
|
126
|
-
"lect": "^0.18.4",
|
|
127
|
-
"rollup": "^2.59.0",
|
|
128
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
129
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
130
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
131
|
-
"rollup-plugin-dts": "^4.0.0",
|
|
132
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
133
|
-
"tap": "^15.0.10",
|
|
134
|
-
"tslib": "^2.3.1",
|
|
135
|
-
"typescript": "^4.4.4"
|
|
136
|
-
},
|
|
137
|
-
"engines": {
|
|
138
|
-
"node": ">=12"
|
|
81
|
+
"@types/lodash.isplainobject": "^4.0.6"
|
|
139
82
|
}
|
|
140
83
|
}
|
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 { isEmpty } from \"ast-is-empty\";\n\nassert.equal(\n isEmpty({\n a: \"\",\n }),\n true\n);\n\nassert.equal(\n isEmpty({\n a: [\"\"],\n b: {\n c: {\n d: \"\",\n },\n },\n }),\n true\n);\n\nassert.equal(\n isEmpty([\n {\n a: [\"\"],\n b: { c: { d: \"\" } },\n },\n \"\",\n [\"\", \"\", \"\"],\n ]),\n true\n);"}}
|