pg-parse-float

restore parseFloat behavior to node-postgres (pg) - can be used as a reference for implementing other type parsing addons

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
pg-parse-float
520.0.111 years ago11 years agoMinified + gzip package size for pg-parse-float in KB

Readme

pg-parse-float
Restore 'parseFloat' functionailty to node-postgres. Allowing it to return float column types as JavaScript floats.

install

npm install pg-parse-float

use

var pg = require('pg');
require('pg-parse-float')(pg);

//now all your floats (float4, float8, numeric) will come back out
//as floats in JavaScript

notes

This can be used as an example of how to extend or override the built in type parsers for other types as well.
There were some discussions around this:
  • https://github.com/brianc/node-postgres/pull/301
  • https://github.com/brianc/node-postgres/pull/271

license

MIT