parse-flow-error-position
v0.1.0
Published
Parse the error position from Flow error message
Downloads
5
Maintainers
Readme
parse-flow-error-position.js
Parse the error position from Flow error message
parseFlowErrorPosition('/foo/bar.js:8:5,10:1: object literal');
/*=>
{
file: '/foo/bar.js',
startLine: 8,
startCol: 5,
endLine: 10,
endCol: 1,
type: 'object literal'
}
*/
Installation
Package managers
npm
npm install parse-flow-error-position
Bower
bower install parse-flow-error-position
Duo
var parseFlowErrorPosition = require('shinnn/parse-flow-error-position.js');
Standalone
Download the script file directly.
AMD support
This repository includes the AMD-friendly build but the package managers doesn't include it. If you want to use it, download it directly.
API
parseFlowErrorPosition(string)
string: String
Return: Object
It takes a line of the error-position information Flow produces, and returns an object which has the following properties:
file
startLine
startCol
endLine
endCol
type
parseFlowErrorPosition('/path/to/script.js:124:5,11: string');
/*=>
{
file: '/foo/bar.js',
startLine: 124,
startCol: 5,
endLine: 124,
endCol: 11,
type: 'string'
}
*/
License
Copyright (c) 2014 Shinnosuke Watanabe
Licensed under the MIT License.