ast-is-empty 3.0.7 → 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/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 and examples.
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
+
@@ -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.7
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 isObj from 'lodash.isplainobject';
11
-
12
- var version$1 = "3.0.7";
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 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};
@@ -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.7
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
- !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})}));
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);})();
@@ -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.7",
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,93 +44,40 @@
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
+ "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
- "tap": {
69
- "check-coverage": false,
70
- "node-arg": [
71
- "--no-warnings",
72
- "--experimental-loader",
73
- "@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/**/*.*"
74
67
  ],
75
- "timeout": 0
68
+ "lines": 100
76
69
  },
77
70
  "lect": {
78
71
  "licence": {
79
72
  "extras": [
80
73
  ""
81
74
  ]
82
- },
83
- "req": "{ isEmpty }",
84
- "various": {
85
- "devDependencies": [
86
- "@types/lodash.isplainobject"
87
- ]
88
75
  }
89
76
  },
90
77
  "dependencies": {
91
- "@babel/runtime": "^7.16.3",
92
78
  "lodash.isplainobject": "^4.0.6"
93
79
  },
94
80
  "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.10",
116
- "@types/tap": "^15.0.5",
117
- "@typescript-eslint/eslint-plugin": "^5.5.0",
118
- "@typescript-eslint/parser": "^5.5.0",
119
- "core-js": "^3.19.2",
120
- "cross-env": "^7.0.3",
121
- "eslint": "^8.3.0",
122
- "lect": "^0.18.7",
123
- "rollup": "^2.60.1",
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.5",
130
- "tslib": "^2.3.1",
131
- "typescript": "^4.5.2"
132
- },
133
- "engines": {
134
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
81
+ "@types/lodash.isplainobject": "^4.0.6"
135
82
  }
136
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 &#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);"}}