Codota Logo For Javascript
isThisExpression
Code IndexAdd Codota to your IDE (free)

How to use
isThisExpression
function
in
@babel/types

Best JavaScript code snippets using @babel/types.isThisExpression(Showing top 2 results out of 1,395)

origin: Ghost---Shadow/unit-test-recorder

// https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export
// Work in progress

// e.g.
// foo.bar.baz('something')
// callee = foo.bar.baz (MemberExpression)
// returns = foo
const getRootObject = (callee, depth = 0) => {
 // TODO: Find a test case for this
 if (!_.isObject(callee)) return {};
 if (callee.object === undefined) {
  return { name: callee.name, depth };
 }
 if (t.isThisExpression(callee.object)) {
  return { name: 'this', depth };
 }

 return getRootObject(callee.object, depth + 1);
}
origin: davidbailey00/ninetales

MemberExpression(path, scope) {
  const { node } = path;
  if (
   (t.isIdentifier(node.property) &&
    (t.isThisExpression(node.object) &&
     (node.property.name === "props" ||
      node.property.name === "state"))) ||
   (t.isIdentifier(node.object) && scope.hasOwnBinding(node.object.name))
  ) {
   throw path.buildCodeFrameError(
    `Expected a constant ` +
     `as part of the template literal expression ` +
     `(eg: <style jsx>{\`p { color: $\{myColor}\`}</style>), ` +
     `but got a MemberExpression: this.${node.property.name}`
   );
  }
 }
@babel/types(npm)isThisExpression

Most used @babel/types functions

  • identifier
  • stringLiteral
  • StringLiteral.value
  • callExpression
  • ImportDeclaration.source
  • isIdentifier,
  • isMemberExpression,
  • objectExpression,
  • objectProperty,
  • variableDeclaration,
  • variableDeclarator,
  • AnyTypeAnnotation.type,
  • ArrayExpression.name,
  • Identifier.name,
  • arrowFunctionExpression,
  • functionExpression,
  • isStringLiteral,
  • memberExpression

Popular in JavaScript

  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • body-parser
    Node.js body parsing middleware
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • postcss
  • ms
    Tiny millisecond conversion utility
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • express
    Fast, unopinionated, minimalist web framework
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now