Tabnine Logo For Javascript
stringLiteral
Code IndexAdd Tabnine to your IDE (free)

How to use
stringLiteral
function
in
@babel/types

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

origin: nodejs/node-v8

// List of string literals of slow tests with duration comments.
function getLiteralsForSlow(leadingComment, slowList) {
 const result = slowList.map(([path, duration]) => {
  const literal = babelTypes.stringLiteral(path);
  babelTypes.addComment(
    literal, 'trailing', ` ${duration / 1000}s`, true);
  return literal;
 });
 if (result.length) {
  babelTypes.addComment(result[0], 'leading', leadingComment);
 }
 return result;
}
origin: nodejs/node-v8

/**
  * Create print statements for printing the magic section prefix that's
  * expected by v8_foozzie.py to differentiate different source files.
  */
 getSectionHeader(path) {
  const orig = common.getOriginalPath(path.node);
  return printValue({
   VALUE: babelTypes.stringLiteral(SECTION_PREFIX + orig),
  });
 }
origin: Banlangenn/banlg

generateEl(isChildren = true, isFirst = false) {
    const propertyArray = [t.objectProperty(t.identifier('path'), t.stringLiteral(`${isChildren ?
        (isFirst ? '' : this.toLowerLine(this.argv.componentName))
        : (isFirst ? '/' : '/' + this.toLowerLine(this.argv.componentName))}`)), t.objectProperty(t.identifier('component'), t.identifier(this.argv.ComponentName))];
    if (this.argv.metaParam) {
      propertyArray.push(t.objectProperty(t.identifier('meta'), t.stringLiteral(this.argv.metaParam)), t.objectProperty(t.identifier('name'), t.stringLiteral(this.argv.componentName)));
    }
    return t.objectExpression(propertyArray);
  }
origin: Ghost---Shadow/unit-test-recorder

const fileMetaGenerator = (meta) => {
 const {
  path, mocks,
 } = meta;
 return t.objectExpression([
  t.objectProperty(t.identifier('path'), t.stringLiteral(path)),
  t.objectProperty(t.identifier('mocks'), t.arrayExpression(mocks.map(mock => t.stringLiteral(mock)))),
 ]);
}
origin: davidbailey00/ninetales

const makeStyledJsxCss = (transformedCss, isTemplateLiteral) => {
 if (!isTemplateLiteral) {
  return t.stringLiteral(transformedCss);
 }
 // Build the expression from transformedCss
 let css;
 traverse(parse(`\`${transformedCss}\``), {
  TemplateLiteral(path) {
   if (!css) {
    css = path.node;
   }
  },
 });
 return css;
}
origin: nodejs/node-v8

/**
 * Turn the key of an object property into a string literal.
 */
function keyToString(key) {
 if (babelTypes.isNumericLiteral(key)) {
  return babelTypes.stringLiteral(key.value.toString());
 }
 if (babelTypes.isIdentifier(key)) {
  return babelTypes.stringLiteral(key.name);
 }
 // Already a string literal.
 return key;
}
origin: Ghost---Shadow/unit-test-recorder

function maybeAddImportStatement(path) {
 if (this.validFunctions.length || this.atLeastOneRecorderWrapperUsed) {
  const recorderImportStatement = buildRequire({
   SOURCE: t.stringLiteral(this.importPath),
   IDENTIFIER: t.identifier('recorderWrapper'),
  });
  path.unshiftContainer('body', recorderImportStatement);
 }

 if (this.atLeastOneMockUsed) {
  const recorderImportStatement = buildRequire({
   SOURCE: t.stringLiteral(this.importPath),
   IDENTIFIER: t.identifier('mockRecorderWrapper'),
  });
  path.unshiftContainer('body', recorderImportStatement);
 }

 const recorderImportStatement = buildRequire({
  SOURCE: t.stringLiteral(this.importPath),
  IDENTIFIER: t.identifier('recordFileMeta'),
 });
 path.unshiftContainer('body', recorderImportStatement);
}
origin: davidbailey00/ninetales

 "void",
 t.callExpression(t.identifier("require"), [
  t.stringLiteral(`./${basename(outFile)}`),
 ])
);
origin: Ghost---Shadow/unit-test-recorder

const metaGenerator = (path, funObj) => {
 const {
  name, isAsync, paramIds, isDefault, isEcmaDefault, injectionWhitelist, isObject,
 } = funObj;
 return t.objectExpression([
  t.objectProperty(t.identifier('path'), t.stringLiteral(path)),
  t.objectProperty(t.identifier('name'), t.stringLiteral(name)),
  // t.objectProperty(t.identifier('localName'), t.stringLiteral(localName)),
  t.objectProperty(t.identifier('paramIds'), t.arrayExpression(paramIds.map(pid => t.stringLiteral(pid)))),
  t.objectProperty(t.identifier('injectionWhitelist'), t.arrayExpression(injectionWhitelist.map(wl => t.stringLiteral(wl)))),
  t.objectProperty(t.identifier('isDefault'), t.booleanLiteral(isDefault)),
  t.objectProperty(t.identifier('isEcmaDefault'), t.booleanLiteral(isEcmaDefault)),
  t.objectProperty(t.identifier('isAsync'), t.booleanLiteral(isAsync)),
  t.objectProperty(t.identifier('isObject'), t.booleanLiteral(isObject)),
 ]);
}
origin: nodejs/node-v8

// List of string literals of failed tests.
function getLiteralsForFailed(leadingComment, failedList) {
 const result = failedList.map(path => babelTypes.stringLiteral(path));
 if (result.length) {
  babelTypes.addComment(result[0], 'leading', leadingComment);
 }
 return result;
}
origin: flexdinesh/cra-babel-eslint

t.callExpression(t.identifier("customSetVal"), [
 stateSetter,
 t.stringLiteral(componentName),
 t.stringLiteral(stateName)
])
origin: Ghost---Shadow/unit-test-recorder

const mockInjectorGenerator = (
 moduleId, moduleName, importId, importedAs,
 newFunctionName, fileName, isObjectLike,
) => {
 if (isObjectLike) {
  return mockInjectorObjLike({
   FP_ID: t.identifier(importedAs),
   NEW_FP_ID: t.identifier(newFunctionName),
   FP_STRING_LITERAL: t.stringLiteral(importedAs),
   MODULE_ID: t.identifier(moduleId),
   MODULE_STRING_LITERAL: t.stringLiteral(moduleName),
   FILE_NAME: t.stringLiteral(fileName),
  });
 }
 return mockInjector({
  FP_ID: t.identifier(importedAs),
  NEW_FP_ID: t.identifier(newFunctionName),
  FP_STRING_LITERAL: t.stringLiteral(importId),
  // MODULE_ID: t.identifier(moduleId),
  MODULE_STRING_LITERAL: t.stringLiteral(moduleName),
  FILE_NAME: t.stringLiteral(fileName),
 });
}
@babel/types(npm)stringLiteral

Most used @babel/types functions

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

Popular in JavaScript

  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • redis
    Redis client library
  • body-parser
    Node.js body parsing middleware
  • winston
    A logger for just about everything.
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • axios
    Promise based HTTP client for the browser and node.js
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now