5.0.5 • Published 2 months ago

xy-parser v5.0.5

Weekly downloads
128
License
MIT
Repository
github
Last release
2 months ago

xy-parser

Parse a text-file and convert it to an array of XY points.

NPM version Test coverage npm download DOI

Installation

$ npm install --save xy-parser

Usage

import { parseXY } from 'xy-parser';
const data = `My file
1   2
3   4
5   6
7   8`;
const result = parseXY(data);
/* result ->
    {
      x: [1, 3, 5, 7],
      y: [2, 4, 6, 8]
    }
  }
*/

const result2 = parseXYAndKeppInfo(data);
/* result2 ->
    data: {
      x: [1, 3, 5, 7],
      y: [2, 4, 6, 8]
    },
    info: [
      'My file'
    ]
  }
*/

The bestGuess option will try to determine which columns should be used.

If there are 3 columns and the first column is a sequential number starting at '1' it looks like this is a line number, we will ignore it.

If there are many columns maybe we have a format like X1, Y1, X2, Y2, ... in this cases if one column on two is a monotone series we will parse it correctly.

API Documentation

License

MIT

5.0.5

2 months ago

5.0.4

1 year ago

5.0.3

1 year ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.0.1

2 years ago

4.0.0

3 years ago

3.2.0

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.0

5 years ago

2.2.2

6 years ago

2.2.1

6 years ago

1.5.0

7 years ago

1.3.0

7 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago