Socket
Socket
Sign inDemoInstall

sourcemap-to-ast

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sourcemap-to-ast

Updates a mozilla AST(produced by acorn/esprima) with location info from a source map


Version published
Maintainers
1
Created
Source

sourcemap-to-ast

Updates a mozilla AST(produced by acorn/esprima) with location info from a source map

Installation

npm install --save sourcemap-to-ast

Usage

var acorn = require('acorn');
var coffee = require('coffee-script');
var sourceMapToAst = require('sourcemap-to-ast');

var compiled = coffee.compile('x =\n 1', {sourceMap: true});
var ast = acorn.parse(compiled.js, {locations: true});

var func = ast.body[0].expression.callee.object;
var funcBody = func.body.body;
var assignment = funcBody[1].expression;

sourceMapToAst(ast, compiled.v3SourceMap);

assignment.loc.start // {line: 1, column: 0}
assignment.loc.end // {line: 2, column: 1}

FAQs

Package last updated on 09 Oct 2013

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc