Replace stack traces with original sources using source-map. For node and the browser.
npm install source-mapper
var sourceMapper = require('source-mapper');
var extracted = sourceMapper.extract(js);
var throughStream = sourceMapper.stream(extracted.map);
extract(string)
extracts an inline source map from the given string. The returned object has thejs
without source maps and amap
with source maps.consumer(map)
returns a source map consumer for the givenmap
.line(consumer, line[, offset])
maps the given line to the original source using a consumer. Ifoffset
is given, it is substracted from the line number.stream(consumer[, offset])
returns a through2 stream that replaces URLs in stack traces with the original source location using a consumer. Ifoffset
is given, it is substracted from the line number.stream(map[, offset])
returns a through2 stream that replaces URLs in stack traces with the original source location using a source map. Ifoffset
is given, it is substracted from the line number.
Clone the repository and then run:
npm install
npm test
- Node 0.10 or later
- Browserify 5.9 or later
MIT