mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-25 22:17:59 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isChildClass = isChildClass;
|
||||
const class_js_1 = require("./class.js");
|
||||
/**
|
||||
* @name isChildClass
|
||||
* @summary Tests if the child extends the parent Class
|
||||
* @description
|
||||
* Checks to see if the child Class extends the parent Class
|
||||
* @example
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import { isChildClass } from '@pezkuwi/util';
|
||||
*
|
||||
* console.log('isChildClass', isChildClass(BN, BN); // => true
|
||||
* console.log('isChildClass', isChildClass(BN, Uint8Array); // => false
|
||||
* ```
|
||||
*/
|
||||
function isChildClass(Parent, Child) {
|
||||
// https://stackoverflow.com/questions/30993434/check-if-a-constructor-inherits-another-in-es6/30993664
|
||||
return (0, class_js_1.isClass)(Child) && (0, class_js_1.isClass)(Parent)
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
? Parent === Child || Parent.isPrototypeOf(Child)
|
||||
: false;
|
||||
}
|
||||
Reference in New Issue
Block a user