How to use the babel-core.types.isIdentifier function in babel-core

To help you get started, we’ve selected a few babel-core 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 martinandert / react-inline / src / transformers / uses.js View on Github external
properties.forEach((property) => {
    if (!t.isIdentifier(property.key)) {
      newProperties.push(property);
      return;
    }

    let value = property.value;

    switch (property.key.name) {
      case 'style':
        /*eslint-disable no-empty */
        if (value === node) {
          // we found our style, but do nothing, because it is
          // later on appended to the className property

          /*eslint-enable no-empty */
        } else if (t.isArrayExpression(value)) {
          var newElements = [];
github RIP21 / babel-plugin-hyperscript-to-jsx / src / rev.js View on Github external
const singleArgumentCase = firstArgument => {
  const isElement = t.isStringLiteral(firstArgument);
  const isReactComponent = t.isIdentifier(firstArgument);
  const isMemberExpression = t.isMemberExpression(firstArgument);
  let attributes = [];
  if (isElement) {
    const { id, className, tag } = getTagAndClassNamesAndId(
      firstArgument.value
    );

    className &&
      attributes.push(
        bJsxAttr(t.JSXIdentifier("className"), processClassName(className))
      );
    id && attributes.push(bJsxAttr(t.JSXIdentifier("id"), t.StringLiteral(id)));
    return bJsxElem({
      selfClosing: true,
      name: tag,
      attributes
github RIP21 / babel-plugin-hyperscript-to-jsx / src / index.js View on Github external
const isHyperscriptCall = node => {
  return t.isIdentifier(node.callee, {
    name: "h"
  });
};
github RIP21 / babel-plugin-hyperscript-to-jsx / src / index.js View on Github external
const singleArgumentCase = firstArgument => {
  const isElement = t.isStringLiteral(firstArgument);
  const isReactComponent = t.isIdentifier(firstArgument);
  const isMemberExpression = t.isMemberExpression(firstArgument);
  let attributes = [];
  if (isElement) {
    const { id, className, tag } = getTagAndClassNamesAndId(
      firstArgument.value
    );
    className &&
      attributes.push(
        bJsxAttr(t.JSXIdentifier("className"), t.StringLiteral(className))
      );
    id && attributes.push(bJsxAttr(t.JSXIdentifier("id"), t.StringLiteral(id)));
    return bJsxElem({
      selfClosing: true,
      name: tag,
      attributes
    });
github martinandert / react-inline / src / transformers / uses.js View on Github external
function evaluateExpression(path, stylesheets) {
  const node = path.node;

  if (!t.isIdentifier(node.object) || !t.isIdentifier(node.property)) {
    return null;
  }

  const sheetId = node.object.name;
  const sheet = stylesheets[sheetId];

  if (!sheet) {
    return null;
  }

  const styleId = node.property.name;
  const style = sheet[styleId];

  if (!style) {
    return null;
  }
github plasticine / inject-loader / src / injectify.js View on Github external
CallExpression(path) {
      if (t.isIdentifier(path.node.callee, { name: 'require' })) {
        dependencies.push(processRequireCall(path));
        path.skip();
      }
    },
  });