Socket
Book a DemoInstallSign in
Socket

babel-value

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-value

Compute simple values from a babel AST.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

babel-value Build Status Coverage Status

Compute simple values from a babel AST.

Will compute the value of an expression AST that was generated using babel. It will not perform any computations, will not hunt down the value of referenced identifiers, etc. It will handle complex object and array literals, as long as they in turn contain nothing computed.

Basically, if the source code that generated the AST looks similar to valid JSON, this should work.

Install

$ npm install --save babel-value

Usage

const babelValue = require('babel-value');

babelValue({
  type: 'StringLiteral',
  value: 'foo'
});
//=> 'foo'

API

babelValue(node)

Returns the computed value of the node, throws if it contains any computed values or identifiers.

input

Type: Node

A babel AST node.

License

MIT © James Talmage

Keywords

babel

FAQs

Package last updated on 02 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts