ast-is-empty 3.0.6 → 3.0.12

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 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
@@ -26,18 +26,17 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`.
30
30
 
31
31
  ```bash
32
32
  npm i ast-is-empty
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 2.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
40
38
  import { strict as assert } from "assert";
39
+
41
40
  import { isEmpty } from "ast-is-empty";
42
41
 
43
42
  assert.equal(
@@ -74,7 +73,7 @@ assert.equal(
74
73
 
75
74
  ## Documentation
76
75
 
77
- Please [visit codsen.com](https://codsen.com/os/ast-is-empty/) for a full description of the API and examples.
76
+ Please [visit codsen.com](https://codsen.com/os/ast-is-empty/) for a full description of the API.
78
77
 
79
78
  ## Contributing
80
79
 
@@ -84,6 +83,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
84
83
 
85
84
  MIT License
86
85
 
87
- Copyright (c) 2010-2021 Roy Revelt and other contributors
86
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
88
87
 
89
88
  <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">
@@ -1,58 +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.6
4
+ * @version 3.0.12
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 isObj from 'lodash.isplainobject';
11
-
12
- var version$1 = "3.0.6";
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
- }
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
- }
46
- }
47
- else if (typeof input === "string") {
48
- if (input.length !== 0) {
49
- return false;
50
- }
51
- }
52
- else {
53
- return null;
54
- }
55
- return res;
56
- }
57
-
58
- export { isEmpty, version };
10
+ import o from"lodash.isplainobject";var n="3.0.12";var d=n;function l(e){let t,s,r=!0;if(Array.isArray(e)){if(e.length===0)return!0;for(t=0,s=e.length;t<s;t++){if(r=l(e[t]),r===null)return null;if(!r)return!1}}else if(o(e)){if(Object.keys(e).length===0)return!0;for(t=0,s=Object.keys(e).length;t<s;t++){if(r=l(e[Object.keys(e)[t]]),r===null)return null;if(!r)return!1}}else if(typeof e=="string"){if(e.length!==0)return!1}else return null;return r}export{l as isEmpty,d as version};
@@ -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.6
4
+ * @version 3.0.12
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.6",Object.defineProperty(t,"__esModule",{value:!0})}));
10
+ var astIsEmpty=(()=>{var m=Object.create;var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var c=e=>o(e,"__esModule",{value:!0});var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),O=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of j(t))!h.call(e,s)&&(r||s!=="default")&&o(e,s,{get:()=>t[s],enumerable:!(n=b(t,s))||n.enumerable});return e},x=(e,t)=>l(c(o(e!=null?m(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=v((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 w(e,t){return function(r){return e(t(r))}}var A=Function.prototype,a=Object.prototype,p=A.toString,T=a.hasOwnProperty,E=p.call(Object),D=a.toString,R=w(Object.getPrototypeOf,Object);function C(e){return!!e&&typeof e=="object"}function F(e){if(!C(e)||D.call(e)!=P||S(e))return!1;var t=R(e);if(t===null)return!0;var r=T.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&p.call(r)==E}u.exports=F});var I={};O(I,{isEmpty:()=>i,version:()=>H});var f=x(y(),1);var d="3.0.12";var H=d;function i(e){let t,r,n=!0;if(Array.isArray(e)){if(e.length===0)return!0;for(t=0,r=e.length;t<r;t++){if(n=i(e[t]),n===null)return null;if(!n)return!1}}else if((0,f.default)(e)){if(Object.keys(e).length===0)return!0;for(t=0,r=Object.keys(e).length;t<r;t++){if(n=i(e[Object.keys(e)[t]]),n===null)return null;if(!n)return!1}}else if(typeof e=="string"){if(e.length!==0)return!1}else return null;return n}return k(I);})();
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { isEmpty } from "../dist/ast-is-empty.esm.js";
5
6
 
6
7
  assert.equal(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-is-empty",
3
- "version": "3.0.6",
3
+ "version": "3.0.12",
4
4
  "description": "Find out, is nested array/object/string/AST tree is empty",
5
5
  "keywords": [
6
6
  "array",
@@ -44,93 +44,43 @@
44
44
  },
45
45
  "types": "types/index.d.ts",
46
46
  "scripts": {
47
- "build": "rollup -c",
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",
51
- "clean_types": "../../scripts/cleanTypes.js",
52
- "dev": "rollup -c --dev",
53
- "devunittest": "npm run dev && tap --only -R 'base'",
54
- "format": "npm run lect && npm run prettier && npm run lint",
55
- "lect": "lect",
56
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
57
- "perf": "node perf/check",
58
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
59
- "republish": "npm publish || :",
60
- "tap": "tap",
61
- "pretest": "npm run build",
62
- "test": "npm run test:ci && npm run perf",
63
- "test:ci": "npm run unittest && npm run test:examples && npm run format",
64
- "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
65
- "tsc": "tsc",
66
- "unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
47
+ "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
48
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
49
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
50
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
51
+ "examples": "node '../../ops/scripts/run-examples.js'",
52
+ "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
53
+ "letspublish": "yarn publish || :",
54
+ "lint": "eslint . --fix",
55
+ "perf": "node perf/check.js",
56
+ "prepare": "echo 'ready'",
57
+ "prettier": "prettier",
58
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
59
+ "pretest": "yarn run lect && yarn run build",
60
+ "test": "yarn run devtest",
61
+ "unit": "uvu test"
67
62
  },
68
- "tap": {
69
- "check-coverage": false,
70
- "node-arg": [
71
- "--no-warnings",
72
- "--experimental-loader",
73
- "@istanbuljs/esm-loader-hook"
63
+ "engines": {
64
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
65
+ },
66
+ "c8": {
67
+ "check-coverage": true,
68
+ "exclude": [
69
+ "**/test/**/*.*"
74
70
  ],
75
- "timeout": 0
71
+ "lines": 100
76
72
  },
77
73
  "lect": {
78
74
  "licence": {
79
75
  "extras": [
80
76
  ""
81
77
  ]
82
- },
83
- "req": "{ isEmpty }",
84
- "various": {
85
- "devDependencies": [
86
- "@types/lodash.isplainobject"
87
- ]
88
78
  }
89
79
  },
90
80
  "dependencies": {
91
- "@babel/runtime": "^7.16.3",
92
81
  "lodash.isplainobject": "^4.0.6"
93
82
  },
94
83
  "devDependencies": {
95
- "@babel/cli": "^7.16.0",
96
- "@babel/core": "^7.16.0",
97
- "@babel/node": "^7.16.0",
98
- "@babel/plugin-external-helpers": "^7.16.0",
99
- "@babel/plugin-proposal-class-properties": "^7.16.0",
100
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
101
- "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
102
- "@babel/plugin-proposal-optional-chaining": "^7.16.0",
103
- "@babel/plugin-transform-runtime": "^7.16.4",
104
- "@babel/preset-env": "^7.16.4",
105
- "@babel/preset-typescript": "^7.16.0",
106
- "@babel/register": "^7.16.0",
107
- "@istanbuljs/esm-loader-hook": "^0.1.2",
108
- "@rollup/plugin-babel": "^5.3.0",
109
- "@rollup/plugin-commonjs": "^21.0.1",
110
- "@rollup/plugin-json": "^4.1.0",
111
- "@rollup/plugin-node-resolve": "^13.0.6",
112
- "@rollup/plugin-strip": "^2.1.0",
113
- "@rollup/plugin-typescript": "^8.3.0",
114
- "@types/lodash.isplainobject": "^4.0.6",
115
- "@types/node": "^16.11.9",
116
- "@types/tap": "^15.0.5",
117
- "@typescript-eslint/eslint-plugin": "^5.4.0",
118
- "@typescript-eslint/parser": "^5.4.0",
119
- "core-js": "^3.19.1",
120
- "cross-env": "^7.0.3",
121
- "eslint": "^8.3.0",
122
- "lect": "^0.18.6",
123
- "rollup": "^2.60.0",
124
- "rollup-plugin-ascii": "^0.0.3",
125
- "rollup-plugin-banner": "^0.2.1",
126
- "rollup-plugin-cleanup": "^3.2.1",
127
- "rollup-plugin-dts": "^4.0.1",
128
- "rollup-plugin-terser": "^7.0.2",
129
- "tap": "^15.1.2",
130
- "tslib": "^2.3.1",
131
- "typescript": "^4.5.2"
132
- },
133
- "engines": {
134
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
84
+ "@types/lodash.isplainobject": "^4.0.6"
135
85
  }
136
86
  }
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 &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; isEmpty &#x7D; from \"ast-is-empty\";\n\nassert.equal(\n isEmpty(&#x7B;\n a: \"\",\n &#x7D;),\n true\n);\n\nassert.equal(\n isEmpty(&#x7B;\n a: [\"\"],\n b: &#x7B;\n c: &#x7B;\n d: \"\",\n &#x7D;,\n &#x7D;,\n &#x7D;),\n true\n);\n\nassert.equal(\n isEmpty([\n &#x7B;\n a: [\"\"],\n b: &#x7B; c: &#x7B; d: \"\" &#x7D; &#x7D;,\n &#x7D;,\n \"\",\n [\"\", \"\", \"\"],\n ]),\n true\n);"}}