parse-flow-error-position

0.1.0 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (19)

    Package Sidebar

    Install

    npm i parse-flow-error-position

    Weekly Downloads

    1

    Version

    0.1.0

    License

    none

    Last publish

    Collaborators

    • shinnn