@rimbu/base 0.9.1 → 0.9.2

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.
@@ -9,17 +9,11 @@ exports.isIterable = exports.isPlainObj = void 0;
9
9
  * @note does not check whether a record's properties are not functions
10
10
  */
11
11
  function isPlainObj(obj) {
12
- if (undefined === obj ||
13
- null === obj ||
14
- typeof obj !== 'object' ||
15
- (obj.constructor instanceof Function &&
16
- obj.constructor.name !== 'Object') ||
17
- Symbol.iterator in obj ||
18
- Symbol.asyncIterator in obj) {
19
- return false;
20
- }
21
- var prototype = Object.getPrototypeOf(obj);
22
- return null === prototype || prototype === Object.prototype;
12
+ return (typeof obj === 'object' &&
13
+ null !== obj &&
14
+ (obj.constructor === Object || !(obj.constructor instanceof Function)) &&
15
+ !(Symbol.iterator in obj) &&
16
+ !(Symbol.asyncIterator in obj));
23
17
  }
24
18
  exports.isPlainObj = isPlainObj;
25
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"plain-object.js","sourceRoot":"","sources":["../../src/plain-object.ts"],"names":[],"mappings":";;;AAgDA;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,GAAQ;IACjC,IACE,SAAS,KAAK,GAAG;QACjB,IAAI,KAAK,GAAG;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,CAAC,GAAG,CAAC,WAAW,YAAY,QAAQ;YAClC,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC;QACpC,MAAM,CAAC,QAAQ,IAAI,GAAG;QACtB,MAAM,CAAC,aAAa,IAAI,GAAG,EAC3B;QACA,OAAO,KAAK,CAAC;KACd;IAED,IAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAE7C,OAAO,IAAI,KAAK,SAAS,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,CAAC;AAC9D,CAAC;AAhBD,gCAgBC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,GAAQ;IACjC,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC;AAC3E,CAAC;AAFD,gCAEC"}
1
+ {"version":3,"file":"plain-object.js","sourceRoot":"","sources":["../../src/plain-object.ts"],"names":[],"mappings":";;;AAgDA;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,GAAQ;IACjC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,IAAI,KAAK,GAAG;QACZ,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,YAAY,QAAQ,CAAC,CAAC;QACtE,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC;QACzB,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,GAAG,CAAC,CAC/B,CAAC;AACJ,CAAC;AARD,gCAQC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,GAAQ;IACjC,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC;AAC3E,CAAC;AAFD,gCAEC"}
@@ -6,17 +6,11 @@
6
6
  * @note does not check whether a record's properties are not functions
7
7
  */
8
8
  export function isPlainObj(obj) {
9
- if (undefined === obj ||
10
- null === obj ||
11
- typeof obj !== 'object' ||
12
- (obj.constructor instanceof Function &&
13
- obj.constructor.name !== 'Object') ||
14
- Symbol.iterator in obj ||
15
- Symbol.asyncIterator in obj) {
16
- return false;
17
- }
18
- const prototype = Object.getPrototypeOf(obj);
19
- return null === prototype || prototype === Object.prototype;
9
+ return (typeof obj === 'object' &&
10
+ null !== obj &&
11
+ (obj.constructor === Object || !(obj.constructor instanceof Function)) &&
12
+ !(Symbol.iterator in obj) &&
13
+ !(Symbol.asyncIterator in obj));
20
14
  }
21
15
  /**
22
16
  * Returns true if the given object is Iterable
@@ -1 +1 @@
1
- {"version":3,"file":"plain-object.js","sourceRoot":"","sources":["../../src/plain-object.ts"],"names":[],"mappings":"AAgDA;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ;IACjC,IACE,SAAS,KAAK,GAAG;QACjB,IAAI,KAAK,GAAG;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,CAAC,GAAG,CAAC,WAAW,YAAY,QAAQ;YAClC,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC;QACpC,MAAM,CAAC,QAAQ,IAAI,GAAG;QACtB,MAAM,CAAC,aAAa,IAAI,GAAG,EAC3B;QACA,OAAO,KAAK,CAAC;KACd;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAE7C,OAAO,IAAI,KAAK,SAAS,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ;IACjC,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC;AAC3E,CAAC"}
1
+ {"version":3,"file":"plain-object.js","sourceRoot":"","sources":["../../src/plain-object.ts"],"names":[],"mappings":"AAgDA;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ;IACjC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,IAAI,KAAK,GAAG;QACZ,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,YAAY,QAAQ,CAAC,CAAC;QACtE,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC;QACzB,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,GAAG,CAAC,CAC/B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ;IACjC,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC;AAC3E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimbu/base",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Utilities to implement Rimbu collections",
5
5
  "keywords": [
6
6
  "array",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "sideEffects": false,
53
53
  "dependencies": {
54
- "@rimbu/common": "^0.9.4",
54
+ "@rimbu/common": "^0.10.0",
55
55
  "tslib": "^2.4.0"
56
56
  },
57
57
  "publishConfig": {
@@ -61,5 +61,5 @@
61
61
  "index": "src/index.ts",
62
62
  "replacer": "../../config/denoify-rimbu-replacer.js"
63
63
  },
64
- "gitHead": "60d3b52050fc30f10921cbf92d637362d663d7e0"
64
+ "gitHead": "4d6b7411c36f599331185b1bc597e58f34954d1a"
65
65
  }
@@ -54,21 +54,13 @@ export type IsAny<T> = 0 extends 1 & T ? true : false;
54
54
  * @note does not check whether a record's properties are not functions
55
55
  */
56
56
  export function isPlainObj(obj: any): boolean {
57
- if (
58
- undefined === obj ||
59
- null === obj ||
60
- typeof obj !== 'object' ||
61
- (obj.constructor instanceof Function &&
62
- obj.constructor.name !== 'Object') ||
63
- Symbol.iterator in obj ||
64
- Symbol.asyncIterator in obj
65
- ) {
66
- return false;
67
- }
68
-
69
- const prototype = Object.getPrototypeOf(obj);
70
-
71
- return null === prototype || prototype === Object.prototype;
57
+ return (
58
+ typeof obj === 'object' &&
59
+ null !== obj &&
60
+ (obj.constructor === Object || !(obj.constructor instanceof Function)) &&
61
+ !(Symbol.iterator in obj) &&
62
+ !(Symbol.asyncIterator in obj)
63
+ );
72
64
  }
73
65
 
74
66
  /**