jsfunx 1.2.0 → 1.2.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.
package/jsfunx.cjs CHANGED
@@ -1551,9 +1551,13 @@ function not(obj) {
1551
1551
  if (len !== 1)
1552
1552
  throw new TypeError(`not() takes exactly one argument (${len} given)`);
1553
1553
 
1554
- if (obj instanceof Boolean) return obj.valueOf() === false;
1554
+ /** @type {*} */
1555
1555
 
1556
- return obj?.length === 0 || !obj; // handling the object case
1556
+ let val = obj?.valueOf();
1557
+
1558
+ if (!(val instanceof Object) || val instanceof Function) return !val;
1559
+
1560
+ return val.length === 0 || !val; // handling the true object case
1557
1561
  }
1558
1562
 
1559
1563
  /**
package/jsfunx.mjs CHANGED
@@ -1555,9 +1555,13 @@ export function not(obj) {
1555
1555
  if (len !== 1)
1556
1556
  throw new TypeError(`not() takes exactly one argument (${len} given)`);
1557
1557
 
1558
- if (obj instanceof Boolean) return obj.valueOf() === false;
1558
+ /** @type {*} */
1559
1559
 
1560
- return obj?.length === 0 || !obj; // handling the object case
1560
+ let val = obj?.valueOf();
1561
+
1562
+ if (!(val instanceof Object) || val instanceof Function) return !val;
1563
+
1564
+ return val.length === 0 || !val; // handling the true object case
1561
1565
  }
1562
1566
 
1563
1567
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfunx",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "JavaScript utility functions for cleaner, more readable code",
5
5
  "main": "./jsfunx.cjs",
6
6
  "module": "./jsfunx.mjs",