dist/types.js
function extendsFrom(TestedClass, RootClass, enforceClasses = false) {
  if (!TestedClass || !RootClass) {
    return false;
  }

  if (TestedClass === RootClass) {
    return true;
  }

  TestedClass = TestedClass.constructor && typeof TestedClass !== 'function' ? TestedClass.constructor : TestedClass;

  RootClass = RootClass.constructor && typeof RootClass !== 'function' ? RootClass.constructor : RootClass;

  let ParentClass = TestedClass;

  if (parseInt(process.version.substring(1)) < 6) {
    throw new Error(`
      Reflect must be implemented in the JavaScript engine. This cannot be
      polyfilled and as such, if process.version is less than 6 an error will
      be thrown. Please try an alternate means of doing what you desire.
    `);
  }

  if (enforceClasses) {
    if (!isClass(TestedClass) && !isClass(RootClass)) {
      throw new Error(`
        When using extendsFrom() with enforceClasses true, each Function
        argument supplied must pass the isClass() method testing. See the
        function isClass to learn more about these requirements.
      `);
    }
  }

  if (!TestedClass || !RootClass) {
    return false;
  }
  if (TestedClass === RootClass) {
    return true;
  }

  do {
    ParentClass = (0, _getPrototypeOf2.default)(ParentClass);

    if (ParentClass === RootClass) {
      return true;
    }
  } while (ParentClass);

  return false;
}
function extendsFrom(TestedClass, RootClass, enforceClasses = false) {
  if (!TestedClass || !RootClass) {
    return false;
  }

  if (TestedClass === RootClass) {
    return true;
  }

  TestedClass = TestedClass.constructor && typeof TestedClass !== 'function' ? TestedClass.constructor : TestedClass;

  RootClass = RootClass.constructor && typeof RootClass !== 'function' ? RootClass.constructor : RootClass;

  let ParentClass = TestedClass;

  if (parseInt(process.version.substring(1)) < 6) {
    throw new Error(`
      Reflect must be implemented in the JavaScript engine. This cannot be
      polyfilled and as such, if process.version is less than 6 an error will
      be thrown. Please try an alternate means of doing what you desire.
    `);
  }

  if (enforceClasses) {
    if (!isClass(TestedClass) && !isClass(RootClass)) {
      throw new Error(`
        When using extendsFrom() with enforceClasses true, each Function
        argument supplied must pass the isClass() method testing. See the
        function isClass to learn more about these requirements.
      `);
    }
  }

  if (!TestedClass || !RootClass) {
    return false;
  }
  if (TestedClass === RootClass) {
    return true;
  }

  do {
    ParentClass = (0, _getPrototypeOf2.default)(ParentClass);

    if (ParentClass === RootClass) {
      return true;
    }
  } while (ParentClass);

  return false;
}
function extendsFrom ( TestedClass , RootClass , enforceClasses = false ) { if ( ! TestedClass || ! RootClass ) { return false ; } if ( TestedClass === RootClass ) { return true ; } TestedClass = TestedClass . constructor && typeof TestedClass !== 'function' ? TestedClass . constructor : TestedClass ; RootClass = RootClass . constructor && typeof RootClass !== 'function' ? RootClass . constructor : RootClass ; let ParentClass = TestedClass ; if ( parseInt ( process . version . substring ( 1 ) ) < 6 ) { throw new Error ( ` ` ) ; } if ( enforceClasses ) { if ( ! isClass ( TestedClass ) && ! isClass ( RootClass ) ) { throw new Error ( ` ` ) ; } } if ( ! TestedClass || ! RootClass ) { return false ; } if ( TestedClass === RootClass ) { return true ; } do { ParentClass = ( 0 , _getPrototypeOf2 . default ) ( ParentClass ) ; if ( ParentClass === RootClass ) { return true ; } } while ( ParentClass ) ; return false ; }
NOTE This function will not work on nodejs versions less than 6 as Reflect
is needed natively.

The instanceof keyword only works on instances of an object and not on
the class objects the instances are created from.

```js
class A {}
class B extends A {}

let a = new A();
let b = new B();

b instanceof A; // true
a instanceof A; // true
B instanceof A; // false
```

Therefore the extendsFrom function checks this relationship at the class
level and not at the instance level.

```js
import { extendsFrom } from '...'

class A {}
class B extends A {}
class C extends B {}

extendsFrom(A, A); // true
extendsFrom(B, A); // true
extendsFrom(C, A); // true
extendsFrom(C, 1); // false
extendsFrom(B, null); // false
```

@method ⌾⠀extendsFrom
@memberof types
@inner

@param {Function} TestedClass the class of which to test heredity
@param {Function} RootClass the ancestor to test for
@param {Boolean} enforceClasses if true, false by default, an additional
runtime check for the type of the supplied Class objects will be made. If
either is not a Function, an error is thrown.
@return {Boolean} true if the lineage exists; false otherwise

@see types#isClass
NOTE This function will not work on nodejs versions less than 6 as Reflect is needed natively .