How to use the NumericLiteral function from babel-types

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

207
208
209
210
211
212
213
214
215
216
function getNodeFromValue (val) {
  const type = typeof val
  if (val === null || type === 'undefined') {
    return t.NullLiteral()
  } else if (type === 'number' || val instanceof Number) {
    return t.NumericLiteral(val)
  } else if (type === 'boolean' || val instanceof Boolean) {
    return t.BooleanLiteral(val)
  } else if (type === 'string' || val instanceof String) {
    return t.StringLiteral(val)
fork icon1
star icon3
watch icon2

+ 11 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)