ast-is-empty 2.1.0 → 3.0.3

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 CHANGED
@@ -3,6 +3,36 @@
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
+ ## 3.0.0 (2021-09-09)
27
+
28
+ ### Features
29
+
30
+ - migrate to ES Modules ([8c9d95d](https://github.com/codsen/codsen/commit/8c9d95d5dea0b769c2f070397141918a4893d575))
31
+
32
+ ### BREAKING CHANGES
33
+
34
+ - programs now are in ES Modules and won't work with Common JS require()
35
+
6
36
  ## 2.1.0 (2021-05-24)
7
37
 
8
38
  ### Features
package/README.md CHANGED
@@ -26,10 +26,14 @@
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:
30
+
29
31
  ```bash
30
32
  npm i ast-is-empty
31
33
  ```
32
34
 
35
+ If you need a legacy version which works with `require`, use version 2.1.0
36
+
33
37
  ## Quick Take
34
38
 
35
39
  ```js
@@ -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 2.1.0
4
+ * @version 3.0.3
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-is-empty/}
@@ -9,7 +9,7 @@
9
9
 
10
10
  import isObj from 'lodash.isplainobject';
11
11
 
12
- var version$1 = "2.1.0";
12
+ var version$1 = "3.0.3";
13
13
 
14
14
  const version = version$1;
15
15
  function isEmpty(input) {
@@ -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 2.1.0
4
+ * @version 3.0.3
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="2.1.0",Object.defineProperty(t,"__esModule",{value:!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.3",Object.defineProperty(t,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-is-empty",
3
- "version": "2.1.0",
3
+ "version": "3.0.3",
4
4
  "description": "Find out, is nested array/object/string/AST tree is empty",
5
5
  "keywords": [
6
6
  "array",
@@ -37,17 +37,21 @@
37
37
  "email": "roy@codsen.com",
38
38
  "url": "https://codsen.com"
39
39
  },
40
- "main": "dist/ast-is-empty.cjs.js",
41
- "module": "dist/ast-is-empty.esm.js",
42
- "browser": "dist/ast-is-empty.umd.js",
40
+ "type": "module",
41
+ "exports": {
42
+ "script": "./dist/ast-is-empty.umd.js",
43
+ "default": "./dist/ast-is-empty.esm.js"
44
+ },
43
45
  "types": "types/index.d.ts",
44
46
  "scripts": {
45
47
  "build": "rollup -c",
46
- "esbuild": "node '../../scripts/esbuild.js'",
47
- "esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
48
48
  "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov",
49
+ "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
50
+ "clean_types": "../../scripts/cleanTypes.js",
49
51
  "dev": "rollup -c --dev",
50
52
  "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'",
51
55
  "format": "npm run lect && npm run prettier && npm run lint",
52
56
  "lect": "lect",
53
57
  "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
@@ -55,22 +59,22 @@
55
59
  "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
56
60
  "republish": "npm publish || :",
57
61
  "tap": "tap",
58
- "tsc": "tsc",
59
62
  "pretest": "npm run build",
60
63
  "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
61
64
  "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
62
- "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf",
63
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
64
- "clean_types": "../../scripts/cleanTypes.js"
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"
65
67
  },
66
68
  "tap": {
69
+ "check-coverage": false,
67
70
  "coverage-report": [
68
71
  "json-summary",
69
72
  "text"
70
73
  ],
71
- "nyc-arg": [
72
- "--exclude=**/*.cjs.js",
73
- "--exclude=**/*.umd.js"
74
+ "node-arg": [
75
+ "--no-warnings",
76
+ "--experimental-loader",
77
+ "@istanbuljs/esm-loader-hook"
74
78
  ],
75
79
  "timeout": 0
76
80
  },
@@ -88,45 +92,49 @@
88
92
  }
89
93
  },
90
94
  "dependencies": {
91
- "@babel/runtime": "^7.14.0",
95
+ "@babel/runtime": "^7.16.0",
92
96
  "lodash.isplainobject": "^4.0.6"
93
97
  },
94
98
  "devDependencies": {
95
- "@babel/cli": "^7.14.3",
96
- "@babel/core": "^7.14.3",
97
- "@babel/node": "^7.14.2",
98
- "@babel/plugin-external-helpers": "^7.12.13",
99
- "@babel/plugin-proposal-class-properties": "^7.13.0",
100
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2",
101
- "@babel/plugin-proposal-object-rest-spread": "^7.14.2",
102
- "@babel/plugin-proposal-optional-chaining": "^7.14.2",
103
- "@babel/plugin-transform-runtime": "^7.14.3",
104
- "@babel/preset-env": "^7.14.2",
105
- "@babel/preset-typescript": "^7.13.0",
106
- "@babel/register": "^7.13.16",
99
+ "@babel/cli": "^7.16.0",
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",
107
112
  "@rollup/plugin-babel": "^5.3.0",
108
- "@rollup/plugin-commonjs": "^19.0.0",
113
+ "@rollup/plugin-commonjs": "^21.0.1",
109
114
  "@rollup/plugin-json": "^4.1.0",
110
- "@rollup/plugin-node-resolve": "^13.0.0",
111
- "@rollup/plugin-strip": "^2.0.1",
112
- "@rollup/plugin-typescript": "^8.2.1",
115
+ "@rollup/plugin-node-resolve": "^13.0.6",
116
+ "@rollup/plugin-strip": "^2.1.0",
117
+ "@rollup/plugin-typescript": "^8.3.0",
113
118
  "@types/lodash.isplainobject": "^4.0.6",
114
- "@types/node": "^15.6.0",
115
- "@types/tap": "^15.0.1",
116
- "@typescript-eslint/eslint-plugin": "^4.24.0",
117
- "@typescript-eslint/parser": "^4.24.0",
118
- "core-js": "^3.12.1",
119
+ "@types/node": "^16.11.6",
120
+ "@types/tap": "^15.0.5",
121
+ "@typescript-eslint/eslint-plugin": "^5.2.0",
122
+ "@typescript-eslint/parser": "^5.2.0",
123
+ "core-js": "^3.19.0",
119
124
  "cross-env": "^7.0.3",
120
- "eslint": "^7.27.0",
121
- "lect": "^0.17.0",
122
- "rollup": "^2.49.0",
125
+ "eslint": "^8.1.0",
126
+ "lect": "^0.18.3",
127
+ "rollup": "^2.59.0",
123
128
  "rollup-plugin-ascii": "^0.0.3",
124
129
  "rollup-plugin-banner": "^0.2.1",
125
130
  "rollup-plugin-cleanup": "^3.2.1",
126
- "rollup-plugin-dts": "^3.0.1",
131
+ "rollup-plugin-dts": "^4.0.0",
127
132
  "rollup-plugin-terser": "^7.0.2",
128
- "tap": "^14.11.0",
129
- "tslib": "^2.2.0",
130
- "typescript": "^4.2.4"
133
+ "tap": "^15.0.10",
134
+ "tslib": "^2.3.1",
135
+ "typescript": "^4.4.4"
136
+ },
137
+ "engines": {
138
+ "node": ">=12"
131
139
  }
132
140
  }
@@ -1,64 +0,0 @@
1
- /**
2
- * @name ast-is-empty
3
- * @fileoverview Find out, is nested array/object/string/AST tree is empty
4
- * @version 2.1.0
5
- * @author Roy Revelt, Codsen Ltd
6
- * @license MIT
7
- * {@link https://codsen.com/os/ast-is-empty/}
8
- */
9
-
10
- 'use strict';
11
-
12
- Object.defineProperty(exports, '__esModule', { value: true });
13
-
14
- var isObj = require('lodash.isplainobject');
15
-
16
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
-
18
- var isObj__default = /*#__PURE__*/_interopDefaultLegacy(isObj);
19
-
20
- var version$1 = "2.1.0";
21
-
22
- var version = version$1;
23
- function isEmpty(input) {
24
- var i;
25
- var len;
26
- var res = true;
27
- if (Array.isArray(input)) {
28
- if (input.length === 0) {
29
- return true;
30
- }
31
- for (i = 0, len = input.length; i < len; i++) {
32
- res = isEmpty(input[i]);
33
- if (res === null) {
34
- return null;
35
- }
36
- if (!res) {
37
- return false;
38
- }
39
- }
40
- } else if (isObj__default['default'](input)) {
41
- if (Object.keys(input).length === 0) {
42
- return true;
43
- }
44
- for (i = 0, len = Object.keys(input).length; i < len; i++) {
45
- res = isEmpty(input[Object.keys(input)[i]]);
46
- if (res === null) {
47
- return null;
48
- }
49
- if (!res) {
50
- return false;
51
- }
52
- }
53
- } else if (typeof input === "string") {
54
- if (input.length !== 0) {
55
- return false;
56
- }
57
- } else {
58
- return null;
59
- }
60
- return res;
61
- }
62
-
63
- exports.isEmpty = isEmpty;
64
- exports.version = version;
@@ -1,211 +0,0 @@
1
- /**
2
- * @name ast-is-empty
3
- * @fileoverview Find out, is nested array/object/string/AST tree is empty
4
- * @version 2.1.0
5
- * @author Roy Revelt, Codsen Ltd
6
- * @license MIT
7
- * {@link https://codsen.com/os/ast-is-empty/}
8
- */
9
-
10
- (function (global, factory) {
11
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
12
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
13
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.astIsEmpty = {}));
14
- }(this, (function (exports) { 'use strict';
15
-
16
- /**
17
- * lodash (Custom Build) <https://lodash.com/>
18
- * Build: `lodash modularize exports="npm" -o ./`
19
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
20
- * Released under MIT license <https://lodash.com/license>
21
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
22
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
23
- */
24
-
25
- /** `Object#toString` result references. */
26
- var objectTag = '[object Object]';
27
-
28
- /**
29
- * Checks if `value` is a host object in IE < 9.
30
- *
31
- * @private
32
- * @param {*} value The value to check.
33
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
34
- */
35
- function isHostObject(value) {
36
- // Many host objects are `Object` objects that can coerce to strings
37
- // despite having improperly defined `toString` methods.
38
- var result = false;
39
- if (value != null && typeof value.toString != 'function') {
40
- try {
41
- result = !!(value + '');
42
- } catch (e) {}
43
- }
44
- return result;
45
- }
46
-
47
- /**
48
- * Creates a unary function that invokes `func` with its argument transformed.
49
- *
50
- * @private
51
- * @param {Function} func The function to wrap.
52
- * @param {Function} transform The argument transform.
53
- * @returns {Function} Returns the new function.
54
- */
55
- function overArg(func, transform) {
56
- return function(arg) {
57
- return func(transform(arg));
58
- };
59
- }
60
-
61
- /** Used for built-in method references. */
62
- var funcProto = Function.prototype,
63
- objectProto = Object.prototype;
64
-
65
- /** Used to resolve the decompiled source of functions. */
66
- var funcToString = funcProto.toString;
67
-
68
- /** Used to check objects for own properties. */
69
- var hasOwnProperty = objectProto.hasOwnProperty;
70
-
71
- /** Used to infer the `Object` constructor. */
72
- var objectCtorString = funcToString.call(Object);
73
-
74
- /**
75
- * Used to resolve the
76
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
77
- * of values.
78
- */
79
- var objectToString = objectProto.toString;
80
-
81
- /** Built-in value references. */
82
- var getPrototype = overArg(Object.getPrototypeOf, Object);
83
-
84
- /**
85
- * Checks if `value` is object-like. A value is object-like if it's not `null`
86
- * and has a `typeof` result of "object".
87
- *
88
- * @static
89
- * @memberOf _
90
- * @since 4.0.0
91
- * @category Lang
92
- * @param {*} value The value to check.
93
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
94
- * @example
95
- *
96
- * _.isObjectLike({});
97
- * // => true
98
- *
99
- * _.isObjectLike([1, 2, 3]);
100
- * // => true
101
- *
102
- * _.isObjectLike(_.noop);
103
- * // => false
104
- *
105
- * _.isObjectLike(null);
106
- * // => false
107
- */
108
- function isObjectLike(value) {
109
- return !!value && typeof value == 'object';
110
- }
111
-
112
- /**
113
- * Checks if `value` is a plain object, that is, an object created by the
114
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
115
- *
116
- * @static
117
- * @memberOf _
118
- * @since 0.8.0
119
- * @category Lang
120
- * @param {*} value The value to check.
121
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
122
- * @example
123
- *
124
- * function Foo() {
125
- * this.a = 1;
126
- * }
127
- *
128
- * _.isPlainObject(new Foo);
129
- * // => false
130
- *
131
- * _.isPlainObject([1, 2, 3]);
132
- * // => false
133
- *
134
- * _.isPlainObject({ 'x': 0, 'y': 0 });
135
- * // => true
136
- *
137
- * _.isPlainObject(Object.create(null));
138
- * // => true
139
- */
140
- function isPlainObject(value) {
141
- if (!isObjectLike(value) ||
142
- objectToString.call(value) != objectTag || isHostObject(value)) {
143
- return false;
144
- }
145
- var proto = getPrototype(value);
146
- if (proto === null) {
147
- return true;
148
- }
149
- var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
150
- return (typeof Ctor == 'function' &&
151
- Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
152
- }
153
-
154
- var lodash_isplainobject = isPlainObject;
155
-
156
- var version$1 = "2.1.0";
157
-
158
- /* eslint @typescript-eslint/explicit-module-boundary-types: 0 */
159
- const version = version$1;
160
- /**
161
- * Find out, is nested array/object/string/AST tree is empty
162
- */
163
- function isEmpty(input) {
164
- let i;
165
- let len;
166
- let res = true;
167
- if (Array.isArray(input)) {
168
- if (input.length === 0) {
169
- return true;
170
- }
171
- for (i = 0, len = input.length; i < len; i++) {
172
- res = isEmpty(input[i]);
173
- if (res === null) {
174
- return null;
175
- }
176
- if (!res) {
177
- return false;
178
- }
179
- }
180
- }
181
- else if (lodash_isplainobject(input)) {
182
- if (Object.keys(input).length === 0) {
183
- return true;
184
- }
185
- for (i = 0, len = Object.keys(input).length; i < len; i++) {
186
- res = isEmpty(input[Object.keys(input)[i]]);
187
- if (res === null) {
188
- return null;
189
- }
190
- if (!res) {
191
- return false;
192
- }
193
- }
194
- }
195
- else if (typeof input === "string") {
196
- if (input.length !== 0) {
197
- return false;
198
- }
199
- }
200
- else {
201
- return null;
202
- }
203
- return res;
204
- }
205
-
206
- exports.isEmpty = isEmpty;
207
- exports.version = version;
208
-
209
- Object.defineProperty(exports, '__esModule', { value: true });
210
-
211
- })));