Sha256: e642db6007dc47356d0d2b8e14ac8b237fafe1385d32b130094c9f4521a30503

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

import { DEBUG } from '@glimmer/env';

const create = Object.create;
const setPrototypeOf = Object.setPrototypeOf;
const defineProperty = Object.defineProperty;

export function classCallCheck(instance, Constructor) {
  if (DEBUG) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError('Cannot call a class as a function');
    }
  }
}

export function inherits(subClass, superClass) {
  if (DEBUG) {
    if (typeof superClass !== 'function' && superClass !== null) {
      throw new TypeError(
        'Super expression must either be null or a function, not ' + typeof superClass
      );
    }
  }
  subClass.prototype = create(superClass === null ? null : superClass.prototype, {
    constructor: {
      value: subClass,
      enumerable: false,
      writable: true,
      configurable: true,
    },
  });
  if (superClass !== null) setPrototypeOf(subClass, superClass);
}

export function taggedTemplateLiteralLoose(strings, raw) {
  strings.raw = raw;
  return strings;
}

function defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ('value' in descriptor) descriptor.writable = true;
    defineProperty(target, descriptor.key, descriptor);
  }
}

export function createClass(Constructor, protoProps, staticProps) {
  if (protoProps !== undefined) defineProperties(Constructor.prototype, protoProps);
  if (staticProps !== undefined) defineProperties(Constructor, staticProps);
  return Constructor;
}

export const possibleConstructorReturn = function(self, call) {
  if (DEBUG) {
    if (!self) {
      throw new ReferenceError(`this hasn't been initialized - super() hasn't been called`);
    }
  }
  return (call !== null && typeof call === 'object') || typeof call === 'function' ? call : self;
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/ember-babel.js