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'
}
*/
npm install parse-flow-error-position
bower install parse-flow-error-position
var parseFlowErrorPosition = require('shinnn/parse-flow-error-position.js');
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.
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'
}
*/
Copyright (c) 2014 Shinnosuke Watanabe
Licensed under the MIT License.