Sha256: 4691e3f185452de49f67385f88b354251fd35cb9ed404e51ff99451256752b6e

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

var __babelPluginTransformClassInheritedHook = function (child, parent, childName) {
  if (childName) {
    Object.defineProperty(child, "name", {
      value: childName,
      configurable: true
    });
  }

  if ("onInherited" in parent) {
    if (typeof parent.onInherited == 'function') {
      var returnedNewChild = parent.onInherited(child);

      if (returnedNewChild !== void 0) {
        if (childName && typeof returnedNewChild == 'function' && returnedNewChild.name !== childName) {
          Object.defineProperty(returnedNewChild, "name", {
            value: childName,
            configurable: true
          });
        }

        child = returnedNewChild;
      }
    } else {
      throw new TypeError("Attempted to call onInherited, but it was not a function");
    }
  }

  return child;
};

let Apple = function () {
  var _class;

  var _Apple = tasty(_class = class extends Fruit {
    tastiness() {
      return 7;
    }
  }) || _class;

  return __babelPluginTransformClassInheritedHook(_Apple, Fruit, "Apple");
}();

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
condenser-0.3 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.2 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.1 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.0.12 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.0.11 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.0.10 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.0.9 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.0.8 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.0.7 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js
condenser-0.0.5 lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/fixtures/ClassDeclarationWithDecorators/expected.js