"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isChildClass = isChildClass;
exports.isCompactEncodable = isCompactEncodable;

var _UInt = _interopRequireDefault(require("../../codec/UInt"));

// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// See if a class is child of another class
// FIMXE This could go in util some day
function isChildClass(Parent, Child) {
  // https://stackoverflow.com/questions/30993434/check-if-a-constructor-inherits-another-in-es6/30993664
  // eslint-disable-next-line no-prototype-builtins
  return Parent === Child || Parent.isPrototypeOf(Child);
}

function isCompactEncodable(Child) {
  return isChildClass(_UInt.default, Child);
}