https://github.com/vweevers/coerce-tabular
An object stream that coerces tabular data to numbers
https://github.com/vweevers/coerce-tabular
Last synced: about 1 year ago
JSON representation
An object stream that coerces tabular data to numbers
- Host: GitHub
- URL: https://github.com/vweevers/coerce-tabular
- Owner: vweevers
- License: mit
- Created: 2015-06-01T09:26:37.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-08-12T09:48:10.000Z (almost 10 years ago)
- Last Synced: 2025-03-28T21:39:05.341Z (about 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# coerce-tabular
**An object stream that coerces tabular data to numbers. Assumes that all incoming objects have the same set of keys and does not fill in missing values. Supports comma and dot notation (1,23 and 1.23).**
[](https://www.npmjs.org/package/coerce-tabular) [](http://travis-ci.org/vweevers/coerce-tabular) [](https://ci.appveyor.com/project/vweevers/coerce-tabular) [](https://david-dm.org/vweevers/coerce-tabular)
## example
`npm i detect-tabular coerce-tabular jsonstream`
```js
var detect = require('detect-tabular')
, coerce = require('coerce-tabular')
, fs = require('fs')
, json = require('jsonstream')
fs.createReadStream('air_pollution_nl.xlsx')
.pipe( detect() )
.pipe( coerce() )
.pipe( json.stringify() )
.pipe( process.stdout )
```
## api
### `coerce()`
Returns a transform stream. Give it objects in the form of `{ name: "Alice", nr: "1e-2" }` and get back `{ name: "Alice", nr: 0.01 }`.
## install
With [npm](https://npmjs.org) do:
```
npm install coerce-tabular
```
## license
[MIT](http://opensource.org/licenses/MIT) © [Vincent Weevers](http://vincentweevers.nl)