is-object-empty2 1.0.0 → 1.0.1

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.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +73 -73
  3. package/package.json +4 -4
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Alex
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,73 +1,73 @@
1
- # is-object-empty2
2
-
3
- <p align="center"><a href="https://nodei.co/npm/is-object-empty2/"><img src="https://nodei.co/npm/is-object-empty2.png"></a></a></p>
4
- <p align="center">
5
- <img src="https://img.shields.io/badge/License-MIT-yellow.svg">
6
- </p>
7
-
8
- # Simple yet robust NPM package that checks if a value is a plain empty object in `JavaScript` and `TypeScript`.
9
-
10
- - Returns `true` **only** for plain objects with no own enumerable properties (`{}` or `Object.create(null)`).
11
- - Returns `false` for arrays, `null`, `undefined`, functions, symbols, BigInt, or objects with keys.
12
- - Correctly handles:
13
- - Objects created with `Object.create(null)`
14
- - Frozen or sealed objects
15
- - Proxy objects (both empty and with keys)
16
- - Objects with inherited properties
17
- - Objects with non-enumerable properties
18
- - Nested or deeply nested objects
19
-
20
-
21
- # 📦 Install via [NPM](https://www.npmjs.com/package/is-object-empty2)
22
-
23
- ```bash
24
- $ npm i is-object-empty2
25
- ```
26
-
27
- # 💻 Usage
28
-
29
- - Returns `true` only for empty objects (`{}`), and `false` for arrays, null, undefined, or objects with keys.
30
- - See examples below
31
-
32
- # JavaScript
33
- ```javascript
34
- const isObjectEmpty2 = require('is-object-empty');
35
-
36
- console.log(isObjectEmpty2({})); // true
37
- console.log(isObjectEmpty2({ a: 1 })); // false
38
- console.log(isObjectEmpty2([])); // false
39
- console.log(isObjectEmpty2(null)); // false
40
- console.log(isObjectEmpty2(undefined)); // false
41
- ```
42
-
43
- # TypeScript
44
- ```javascript
45
- import isObjectEmpty2 = require('is-object-empty');
46
-
47
- const testValues: unknown[] = [
48
- {},
49
- { a: 1 },
50
- [],
51
- null,
52
- undefined,
53
- Object.create(null),
54
- { nested: {} }
55
- ];
56
-
57
- for (const value of testValues) {
58
- const result: boolean = isObjectEmpty2(value);
59
- console.log(`${JSON.stringify(value)} → ${result}`);
60
- }
61
-
62
- /*
63
- --| Expected values:
64
-
65
- {} → true
66
- {"a":1} → false
67
- [] → false
68
- null → false
69
- undefined → false
70
- {} → true
71
- {"nested":{}} → false
72
- */
73
- ```
1
+ # is-object-empty2
2
+
3
+ <p align="center"><a href="https://nodei.co/npm/is-object-empty2/"><img src="https://nodei.co/npm/is-object-empty2.png"></a></a></p>
4
+ <p align="center">
5
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg">
6
+ </p>
7
+
8
+ # Simple yet robust NPM package that checks if a value is a plain empty object in `JavaScript` and `TypeScript`.
9
+
10
+ - Returns `true` **only** for plain objects with no own enumerable properties (`{}` or `Object.create(null)`).
11
+ - Returns `false` for arrays, `null`, `undefined`, functions, symbols, BigInt, or objects with keys.
12
+ - Correctly handles:
13
+ - Objects created with `Object.create(null)`
14
+ - Frozen or sealed objects
15
+ - Proxy objects (both empty and with keys)
16
+ - Objects with inherited properties
17
+ - Objects with non-enumerable properties
18
+ - Nested or deeply nested objects
19
+
20
+
21
+ # 📦 Install via [NPM](https://www.npmjs.com/package/is-object-empty2)
22
+
23
+ ```bash
24
+ $ npm i is-object-empty2
25
+ ```
26
+
27
+ # 💻 Usage
28
+
29
+ - Returns `true` only for empty objects (`{}`), and `false` for arrays, null, undefined, or objects with keys.
30
+ - See examples below
31
+
32
+ # JavaScript
33
+ ```javascript
34
+ const isObjectEmpty2 = require('is-object-empty');
35
+
36
+ console.log(isObjectEmpty2({})); // true
37
+ console.log(isObjectEmpty2({ a: 1 })); // false
38
+ console.log(isObjectEmpty2([])); // false
39
+ console.log(isObjectEmpty2(null)); // false
40
+ console.log(isObjectEmpty2(undefined)); // false
41
+ ```
42
+
43
+ # TypeScript
44
+ ```javascript
45
+ import isObjectEmpty2 = require('is-object-empty');
46
+
47
+ const testValues: unknown[] = [
48
+ {},
49
+ { a: 1 },
50
+ [],
51
+ null,
52
+ undefined,
53
+ Object.create(null),
54
+ { nested: {} }
55
+ ];
56
+
57
+ for (const value of testValues) {
58
+ const result: boolean = isObjectEmpty2(value);
59
+ console.log(`${JSON.stringify(value)} → ${result}`);
60
+ }
61
+
62
+ /*
63
+ --| Expected values:
64
+
65
+ {} → true
66
+ {"a":1} → false
67
+ [] → false
68
+ null → false
69
+ undefined → false
70
+ {} → true
71
+ {"nested":{}} → false
72
+ */
73
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "is-object-empty2",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "📦 Tiny utility to check if a value is a plain empty object in JavaScript or TypeScript",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/tutyamxx/is-object-empty"
12
+ "url": "https://github.com/tutyamxx/is-object-empty2"
13
13
  },
14
14
  "keywords": [
15
15
  "is-object-empty",
@@ -20,9 +20,9 @@
20
20
  "author": "tuty",
21
21
  "license": "MIT",
22
22
  "bugs": {
23
- "url": "https://github.com/tutyamxx/is-object-empty/issues"
23
+ "url": "https://github.com/tutyamxx/is-object-empty2/issues"
24
24
  },
25
- "homepage": "https://github.com/tutyamxx/is-object-empty#readme",
25
+ "homepage": "https://github.com/tutyamxx/is-object-empty2#readme",
26
26
  "devDependencies": {
27
27
  "jest": "^30.2.0"
28
28
  },