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