How to use the babel-helpers.get function in babel-helpers

To help you get started, we’ve selected a few babel-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce / lwc / packages / babel-helpers-lwc / src / index.js View on Github external
helpers.list.forEach(function (name) {
        if (whitelist && whitelist.indexOf(name) < 0) return;

        const key = t.identifier(name);

        // AST tree for: objectMember.helperName = function () { ... }
        body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(t.identifier('babelHelpers'), key), helpers.get(name))));
    });
}
github brianZeng / babel-plugin-transform-helper / src / HelperRemap.js View on Github external
getUsedMethods({exclude}={}){
    if (!Array.isArray(exclude)) {
      exclude = [];
    }
    let ret = [];
    for (let name of this.usedHelpers) {
      if (exclude.indexOf(name) == -1) {
        let METHOD = this._definedHelpers[name] || babelHelpers.get(name);
        ret.push(helperDefineTemplate({
          METHOD_NAME: Identifier(name),
          METHOD
        }))
      }
    }
    return ret;
  }
github LivelyKernel / lively4-core / src / external / plugin-babel / build-babel / systemjs-build-modular-babel-helpers.js View on Github external
helpers.list.forEach(function(helperName) {
  var tree = t.program([
    t.exportDefaultDeclaration(helpers.get(helperName))
  ]);
  
  fs.writeFileSync('../babel-helpers/' + helperName + '.js', babel.transformFromAst(tree).code);
});
github babel / babel / packages / babel-core / src / tools / build-external-helpers.js View on Github external
each(helpers.list, function (name) {
    if (whitelist && whitelist.indexOf(name) < 0) return;

    let key = t.identifier(name);
    body.push(t.expressionStatement(
      t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name))
    ));
  });
}
github ksherlock / better-babel-cli / babel-external-helpers.js View on Github external
list.forEach( function(fn){
		if (whitelist && whitelist.indexOf(fn) < 0) return;

		callback(fn, bh.get(fn));
	});
}
github babel / babel / packages / babel-core / src / tools / build-external-helpers.js View on Github external
function buildGlobal(namespace, builder) {
  let body      = [];
  let container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));
  let tree      = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]);

  body.push(t.variableDeclaration("var", [
    t.variableDeclarator(
      namespace,
      t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([]))
    )
  ]));

  builder(body);

  return tree;
}

babel-helpers

Collection of helper functions used by Babel transforms.

MIT
Latest version published 7 years ago

Package Health Score

82 / 100
Full package analysis

Similar packages