Skip to content
Parse the error position from Flow error message
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dist
src
.editorconfig
.gitattributes
.gitignore
.jscs.json
.jshintrc
.travis.yml
LICENSE
README.md
appveyor.yml
bower.json
component.json
gulpfile.js
package.json
test.js

README.md

parse-flow-error-position.js

Build Status Build status Coverage Status devDependency Status

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 version

npm install parse-flow-error-position

Bower Bower version

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.

Something went wrong with that request. Please try again.