@ohos-ports/stdlib-assert-is-error 0.2.3-beta.0 → 0.2.3-beta.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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";var o=function(r,t){return function(){return t||r((t={exports:{}}).exports,t),t.exports}};var i=o(function(p,e){
2
- var s=function(r){if(r===null||r===void 0)return null;r=Object(r);return typeof Object.getPrototypeOf=="function"?Object.getPrototypeOf(r):r.__proto__},n=function(r){return Object.prototype.toString.call(r)};function f(r){if(typeof r!="object"||r===null)return!1;if(r instanceof Error)return!0;for(;r;){if(n(r)==="[object Error]")return!0;r=s(r)}return!1}e.exports=f
2
+ var s=require('@stdlib/utils-get-prototype-of/dist'),n=require('@stdlib/utils-native-class/dist');function f(r){if(typeof r!="object"||r===null)return!1;if(r instanceof Error)return!0;for(;r;){if(n(r)==="[object Error]")return!0;r=s(r)}return!1}e.exports=f
3
3
  });var u=i();module.exports=u;
4
4
  /** @license Apache-2.0 */
5
5
  //# sourceMappingURL=index.js.map
package/lib/index.js CHANGED
@@ -35,57 +35,6 @@
35
35
 
36
36
  // MODULES //
37
37
 
38
- // POLYFILL //
39
-
40
- /*
41
- * HarmonyOS Node engine conformance shim (idempotent, no-op on conforming engines):
42
- *
43
- * Some HarmonyOS Node builds (e.g., v26.8.2) omit the ES2015+-required
44
- * `Symbol.toStringTag` property on the `.prototype` objects of the built-in
45
- * error constructors (`Error`, `TypeError`, `RangeError`, `SyntaxError`,
46
- * `EvalError`, `ReferenceError`, `URIError`). Per the ECMAScript specification,
47
- * `Error.prototype[Symbol.toStringTag]` must be `'Error'` (and analogous values
48
- * for the other constructors). When missing, `Object.prototype.toString.call()`
49
- * classifies a bare error `.prototype` as `'[object Object]'`, which breaks
50
- * `@stdlib/utils-native-class`-based detection of `Error.prototype` itself.
51
- *
52
- * We only define the spec-required property when it is absent, so runtime
53
- * behavior on conforming engines is unchanged. The `try/catch` guard prevents
54
- * failures in frozen/sealed environments.
55
- */
56
- ( function () {
57
- var ctors = [
58
- [ Error, 'Error' ],
59
- [ TypeError, 'TypeError' ],
60
- [ RangeError, 'RangeError' ],
61
- [ SyntaxError, 'SyntaxError' ],
62
- [ EvalError, 'EvalError' ],
63
- [ ReferenceError, 'ReferenceError' ],
64
- [ URIError, 'URIError' ]
65
- ];
66
- if ( typeof Symbol.toStringTag !== 'symbol' ) {
67
- return;
68
- }
69
- for ( var i = 0; i < ctors.length; i++ ) {
70
- try {
71
- if (
72
- ctors[ i ][ 0 ] &&
73
- ctors[ i ][ 0 ].prototype &&
74
- Object.getOwnPropertyDescriptor( ctors[ i ][ 0 ].prototype, Symbol.toStringTag ) === undefined
75
- ) {
76
- Object.defineProperty( ctors[ i ][ 0 ].prototype, Symbol.toStringTag, {
77
- 'configurable': true,
78
- 'enumerable': false,
79
- 'writable': false,
80
- 'value': ctors[ i ][ 1 ]
81
- } );
82
- }
83
- } catch ( err ) {
84
- // Ignore failures (e.g., frozen or sealed environments)...
85
- }
86
- }
87
- } )();
88
-
89
38
  var main = require( './main.js' );
90
39
 
91
40
 
package/lib/main.js CHANGED
@@ -20,27 +20,8 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- // VENDORED MODULES //
24
-
25
- // Vendored from @stdlib/utils-native-class@0.2.3 (avoids npm EBADPLATFORM on openharmony: upstream os whitelist lacks 'openharmony') //
26
- var toStr = Object.prototype.toString;
27
- function nativeClass( v ) {
28
- return toStr.call( v );
29
- }
30
-
31
- // Vendored from @stdlib/utils-get-prototype-of@0.2.3 (avoids npm EBADPLATFORM on openharmony) //
32
- function getPrototypeOf( value ) {
33
- if ( value === null || value === void 0 ) {
34
- return null;
35
- }
36
- // Cast input value to an object (strings, numbers, booleans) to ensure consistent ES5/ES6 behavior...
37
- value = Object( value );
38
- if ( typeof Object.getPrototypeOf === 'function' ) {
39
- return Object.getPrototypeOf( value );
40
- }
41
- // Legacy fallback for environments lacking `Object.getPrototypeOf`...
42
- return value.__proto__;
43
- }
23
+ var getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );
24
+ var nativeClass = require( '@stdlib/utils-native-class' );
44
25
 
45
26
 
46
27
  // MAIN //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohos-ports/stdlib-assert-is-error",
3
- "version": "0.2.3-beta.0",
3
+ "version": "0.2.3-beta.1",
4
4
  "description": "Test if a value is an Error object.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -30,7 +30,10 @@
30
30
  "bugs": {
31
31
  "url": "https://github.com/ohos-ports/ohos-ports/issues"
32
32
  },
33
- "dependencies": {},
33
+ "dependencies": {
34
+ "@stdlib/utils-get-prototype-of": "^0.2.3",
35
+ "@stdlib/utils-native-class": "^0.2.3"
36
+ },
34
37
  "devDependencies": {},
35
38
  "engines": {
36
39
  "node": ">=0.10.0",
@@ -43,10 +46,10 @@
43
46
  "linux",
44
47
  "macos",
45
48
  "openbsd",
49
+ "openharmony",
46
50
  "sunos",
47
51
  "win32",
48
- "windows",
49
- "openharmony"
52
+ "windows"
50
53
  ],
51
54
  "keywords": [
52
55
  "stdlib",
@@ -75,4 +78,4 @@
75
78
  "type": "opencollective",
76
79
  "url": "https://opencollective.com/stdlib"
77
80
  }
78
- }
81
+ }