function isEnumStringCast()

in packages/eslint-plugin-fb-flow/rules/no-flow-enums-object-mapping.js [62:78]


function isEnumStringCast(node) {
  if (node.type === 'CallExpression') {
    const {callee, arguments: args} = node;
    return (
      callee.type === 'Identifier' &&
      callee.name === 'String' &&
      isEnumAccess(args[0])
    );
  } else if (node.type === 'TypeCastExpression') {
    const {typeAnnotation, expression} = node;
    return (
      typeAnnotation.typeAnnotation.type == 'StringTypeAnnotation' &&
      isEnumAccess(expression)
    );
  }
  return false;
}