@opra/common 1.0.0-beta.6 → 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.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cloneObject = cloneObject;
4
4
  exports.omitUndefined = omitUndefined;
5
5
  exports.omitNullish = omitNullish;
6
+ exports.isBuiltInObject = isBuiltInObject;
6
7
  const tslib_1 = require("tslib");
7
8
  const putil_isplainobject_1 = tslib_1.__importDefault(require("putil-isplainobject"));
8
9
  const putil_merge_1 = tslib_1.__importDefault(require("putil-merge"));
@@ -39,3 +40,18 @@ function omitNullish(obj, recursive) {
39
40
  }
40
41
  return obj;
41
42
  }
43
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
44
+ function isBuiltInObject(v) {
45
+ return (Array.isArray(v) ||
46
+ (typeof v === 'object' &&
47
+ (v instanceof Date ||
48
+ v instanceof RegExp ||
49
+ v instanceof Map ||
50
+ v instanceof Set ||
51
+ v instanceof ArrayBuffer ||
52
+ v instanceof SharedArrayBuffer ||
53
+ v instanceof Promise ||
54
+ v instanceof Error ||
55
+ v instanceof TypedArray ||
56
+ Buffer.isBuffer(v))));
57
+ }
@@ -33,3 +33,18 @@ export function omitNullish(obj, recursive) {
33
33
  }
34
34
  return obj;
35
35
  }
36
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
37
+ export function isBuiltInObject(v) {
38
+ return (Array.isArray(v) ||
39
+ (typeof v === 'object' &&
40
+ (v instanceof Date ||
41
+ v instanceof RegExp ||
42
+ v instanceof Map ||
43
+ v instanceof Set ||
44
+ v instanceof ArrayBuffer ||
45
+ v instanceof SharedArrayBuffer ||
46
+ v instanceof Promise ||
47
+ v instanceof Error ||
48
+ v instanceof TypedArray ||
49
+ Buffer.isBuffer(v))));
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.1",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -2,3 +2,4 @@ import type { DeeperOmitTypes } from 'ts-gems';
2
2
  export declare function cloneObject<T extends {}>(obj: T, jsonOnly?: boolean): T;
3
3
  export declare function omitUndefined<T>(obj: T, recursive?: boolean): T;
4
4
  export declare function omitNullish<T>(obj: T, recursive?: boolean): DeeperOmitTypes<T, null | undefined>;
5
+ export declare function isBuiltInObject(v: any): boolean;