UNPKG

@itwin/core-bentley

Version:

Bentley JavaScript core components

32 lines 1.55 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Utils */ Object.defineProperty(exports, "__esModule", { value: true }); exports.isProperSubclassOf = isProperSubclassOf; exports.isSubclassOf = isSubclassOf; /** Check if class `subclass` is a different class from `superclass` but extends from `superclass` * @param subclass the class that may be a subclass of `superclass` * @param superclass the class that may be a base class of `subclass` * @note The constructors of all types must be `public`. * @returns whether `subclass` is a proper subclass of `superclass` * @public */ function isProperSubclassOf(subclass, superclass) { return subclass.prototype instanceof superclass; } /** Check if class `subclass` is `superclass` or extends from `superclass` * @param subclass the class that may be a subclass of `superclass`. * @param superclass the class that may be a base class of `subclass`. * @note The constructors of all types must be `public`. * @returns whether `subclass` is a subclass of `superclass` * @public */ function isSubclassOf(subclass, superclass) { return subclass === superclass || isProperSubclassOf(subclass, superclass); } //# sourceMappingURL=ClassUtils.js.map