ast-is-empty 3.0.3 → 3.0.7
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/dist/ast-is-empty.esm.js +37 -34
- package/dist/ast-is-empty.umd.js +2 -2
- package/package.json +21 -25
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/dist/ast-is-empty.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-is-empty/}
|
|
@@ -9,47 +9,50 @@
|
|
|
9
9
|
|
|
10
10
|
import isObj from 'lodash.isplainobject';
|
|
11
11
|
|
|
12
|
-
var version$1 = "3.0.
|
|
12
|
+
var version$1 = "3.0.7";
|
|
13
13
|
|
|
14
14
|
const version = version$1;
|
|
15
15
|
function isEmpty(input) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
}
|
|
22
32
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
else if (isObj(input)) {
|
|
34
|
+
if (Object.keys(input).length === 0) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
for (i = 0, len = Object.keys(input).length; i < len; i++) {
|
|
38
|
+
res = isEmpty(input[Object.keys(input)[i]]);
|
|
39
|
+
if (res === null) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (!res) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
31
46
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
else if (typeof input === "string") {
|
|
48
|
+
if (input.length !== 0) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
35
51
|
}
|
|
36
|
-
|
|
37
|
-
res = isEmpty(input[Object.keys(input)[i]]);
|
|
38
|
-
if (res === null) {
|
|
52
|
+
else {
|
|
39
53
|
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
54
|
}
|
|
49
|
-
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
return res;
|
|
55
|
+
return res;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
export { isEmpty, 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.7
|
|
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
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).astIsEmpty={})}(this,(function(t){"use strict";var e,n,r=Object.prototype,o=Function.prototype.toString,f=r.hasOwnProperty,i=o.call(Object),u=r.toString,l=(e=Object.getPrototypeOf,n=Object,function(t){return e(n(t))});var c=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=u.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=l(t);if(null===e)return!0;var n=f.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&o.call(n)==i};t.isEmpty=function t(e){let n,r,o=!0;if(Array.isArray(e)){if(0===e.length)return!0;for(n=0,r=e.length;n<r;n++){if(o=t(e[n]),null===o)return null;if(!o)return!1}}else if(c(e)){if(0===Object.keys(e).length)return!0;for(n=0,r=Object.keys(e).length;n<r;n++){if(o=t(e[Object.keys(e)[n]]),null===o)return null;if(!o)return!1}}else{if("string"!=typeof e)return null;if(0!==e.length)return!1}return o},t.version="3.0.
|
|
10
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).astIsEmpty={})}(this,(function(t){"use strict";var e,n,r=Object.prototype,o=Function.prototype.toString,f=r.hasOwnProperty,i=o.call(Object),u=r.toString,l=(e=Object.getPrototypeOf,n=Object,function(t){return e(n(t))});var c=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=u.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=l(t);if(null===e)return!0;var n=f.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&o.call(n)==i};t.isEmpty=function t(e){let n,r,o=!0;if(Array.isArray(e)){if(0===e.length)return!0;for(n=0,r=e.length;n<r;n++){if(o=t(e[n]),null===o)return null;if(!o)return!1}}else if(c(e)){if(0===Object.keys(e).length)return!0;for(n=0,r=Object.keys(e).length;n<r;n++){if(o=t(e[Object.keys(e)[n]]),null===o)return null;if(!o)return!1}}else{if("string"!=typeof e)return null;if(0!==e.length)return!1}return o},t.version="3.0.7",Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ast-is-empty",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Find out, is nested array/object/string/AST tree is empty",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -45,13 +45,12 @@
|
|
|
45
45
|
"types": "types/index.d.ts",
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "rollup -c",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"build:esbuild": "node '../../scripts/esbuild.js'",
|
|
49
|
+
"build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
50
|
+
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
|
|
50
51
|
"clean_types": "../../scripts/cleanTypes.js",
|
|
51
52
|
"dev": "rollup -c --dev",
|
|
52
53
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
53
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
54
|
-
"esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
55
54
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
56
55
|
"lect": "lect",
|
|
57
56
|
"lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
|
|
@@ -60,17 +59,14 @@
|
|
|
60
59
|
"republish": "npm publish || :",
|
|
61
60
|
"tap": "tap",
|
|
62
61
|
"pretest": "npm run build",
|
|
63
|
-
"test": "npm run
|
|
62
|
+
"test": "npm run test:ci && npm run perf",
|
|
63
|
+
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
64
64
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
65
65
|
"tsc": "tsc",
|
|
66
|
-
"unittest": "tap --no-only --
|
|
66
|
+
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
67
67
|
},
|
|
68
68
|
"tap": {
|
|
69
69
|
"check-coverage": false,
|
|
70
|
-
"coverage-report": [
|
|
71
|
-
"json-summary",
|
|
72
|
-
"text"
|
|
73
|
-
],
|
|
74
70
|
"node-arg": [
|
|
75
71
|
"--no-warnings",
|
|
76
72
|
"--experimental-loader",
|
|
@@ -92,7 +88,7 @@
|
|
|
92
88
|
}
|
|
93
89
|
},
|
|
94
90
|
"dependencies": {
|
|
95
|
-
"@babel/runtime": "^7.16.
|
|
91
|
+
"@babel/runtime": "^7.16.3",
|
|
96
92
|
"lodash.isplainobject": "^4.0.6"
|
|
97
93
|
},
|
|
98
94
|
"devDependencies": {
|
|
@@ -104,8 +100,8 @@
|
|
|
104
100
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
105
101
|
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
106
102
|
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
107
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
108
|
-
"@babel/preset-env": "^7.16.
|
|
103
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
104
|
+
"@babel/preset-env": "^7.16.4",
|
|
109
105
|
"@babel/preset-typescript": "^7.16.0",
|
|
110
106
|
"@babel/register": "^7.16.0",
|
|
111
107
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
@@ -116,25 +112,25 @@
|
|
|
116
112
|
"@rollup/plugin-strip": "^2.1.0",
|
|
117
113
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
118
114
|
"@types/lodash.isplainobject": "^4.0.6",
|
|
119
|
-
"@types/node": "^16.11.
|
|
115
|
+
"@types/node": "^16.11.10",
|
|
120
116
|
"@types/tap": "^15.0.5",
|
|
121
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
122
|
-
"@typescript-eslint/parser": "^5.
|
|
123
|
-
"core-js": "^3.19.
|
|
117
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
118
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
119
|
+
"core-js": "^3.19.2",
|
|
124
120
|
"cross-env": "^7.0.3",
|
|
125
|
-
"eslint": "^8.
|
|
126
|
-
"lect": "^0.18.
|
|
127
|
-
"rollup": "^2.
|
|
121
|
+
"eslint": "^8.3.0",
|
|
122
|
+
"lect": "^0.18.7",
|
|
123
|
+
"rollup": "^2.60.1",
|
|
128
124
|
"rollup-plugin-ascii": "^0.0.3",
|
|
129
125
|
"rollup-plugin-banner": "^0.2.1",
|
|
130
126
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
131
|
-
"rollup-plugin-dts": "^4.0.
|
|
127
|
+
"rollup-plugin-dts": "^4.0.1",
|
|
132
128
|
"rollup-plugin-terser": "^7.0.2",
|
|
133
|
-
"tap": "^15.
|
|
129
|
+
"tap": "^15.1.5",
|
|
134
130
|
"tslib": "^2.3.1",
|
|
135
|
-
"typescript": "^4.
|
|
131
|
+
"typescript": "^4.5.2"
|
|
136
132
|
},
|
|
137
133
|
"engines": {
|
|
138
|
-
"node": ">=
|
|
134
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
139
135
|
}
|
|
140
136
|
}
|