Skip to content

cheminfo/ndim-parser

Repository files navigation

ndim-parser

NPM version build status Test coverage npm download

File parser for n-dimensional values.

Installation

$ npm i ndim-parser

Usage

import { ndParse } from 'ndim-parser';

const simpleExample = `
meta.first,1
meta.second,,2
temp, volt, curr
1,1,1
2,2,2
3,3,3
`;

expect(ndParse(simpleExample, { separator: ',' })).toStrictEqual({
  data: {
    t: { data: [1, 2, 3], label: 'temp' },
    v: { data: [1, 2, 3], label: 'volt' },
    c: { data: [1, 2, 3], label: 'curr' },
  },
  meta: {
    'meta.first': '1',
    'meta.second': '2',
  },
});

License

MIT