How to use the assertIdentifier function from babel-types

Find comprehensive JavaScript babel-types.assertIdentifier code examples handpicked from public code repositorys.

97
98
99
100
101
102
103
104
105
106
    "  const src = fs.readFileSync(path.join(__dirname, 'foo.txt'));\n");
}

function extractRequiredModule (node) {
  t.assertCallExpression(node);
  t.assertIdentifier(node.callee, { name: 'require' });
  var arg = node.arguments[0];
  t.assertStringLiteral(arg);
  return arg.value;
}
fork icon11
star icon0
watch icon2

+ 7 other calls in file

41
42
43
44
45
46
47
48
49
50
});

it('converts string#format=uuid to ID', () => {
  const builtIn = new BuiltInTypes();
  const ref = builtIn.resolveSwagger({ type: 'string', format: 'uuid' });
  t.assertIdentifier(ref, { name: 'GraphQLID' });
});

it('returns null for invalid types', () => {
  const builtIn = new BuiltInTypes();
fork icon3
star icon0
watch icon0

+ 5 other calls in file

32
33
34
35
36
37
38
39
40
41
  const builtIn = new BuiltInTypes();
  const typeMap = new TypeMap(builtIn);
  typeMap.addSwaggerDefinition(SIMPLE_OBJ, 'My.Type/#bar');
  const type = typeMap.getBySwaggerName('My.Type/#bar');
  assert.equal('MyTypeBar', type.graphqlName);
  t.assertIdentifier(type.ref(), { name: type.graphqlName });
});

it('can handle naming collisions', () => {
  const builtIn = new BuiltInTypes();
fork icon3
star icon0
watch icon0

+ 15 other calls in file

54
55
56
57
58
59
60
61
62
63
  'creates individual connection types for each element type',
  AConnectionType,
  BConnectionType
);

t.assertIdentifier(AConnectionType, { name: 'AConnection' });
t.assertIdentifier(BConnectionType, { name: 'BConnection' });

const AConnectionAST = typeMap.getBySwaggerName('AConnection').ast;
const AEdgeAST = typeMap.getBySwaggerName('AEdge').ast;
fork icon3
star icon0
watch icon0

+ 3 other calls in file

Other functions in babel-types

Sorted by popularity

function icon

babel-types.identifier is the most popular function in babel-types (4076 examples)