floatify

1.4.0 • Public • Published

floatify . Common helper to floatify strings

Build Status Scrutinizer Code Quality Code Coverage

New optional toggle

Since v1.4.0 you have a 2nd optional parameter to prefer decimal separator instead of thousands separators (old standard, new default behaviour. See Issue #8 and test/floatify.js for details)

BC Break

Since v1.3.0 floatify exports as function!

var floatify = require("floatify")
// old: floatify.floatify("123123.245346556")
// new:
floatify("123123.245346556")

Usage

Example

var floatify = require("floatify")
floatify("123123.245346556")
>> 123123.245346556
floatify("123.242,5346556")
>> 123242.5346556
floatify("123,242.5346556")
>> 123242.5346556
floatify("123 242 123.7568")
>> 123242123.7568

for more detailed examples see Mocha Testcases in test/floatify.js

Installation with npm

with npm

npm i floatify

with yarn

yarn add floatify

Clone repo

via ssh

git clone git@github.com:pocketrocket/floatify

via https

git clone https://github.com/pocketrocket/floatify.git

Testing

Basic testing done, use npm test or yarn test

Package Sidebar

Install

npm i floatify

Weekly Downloads

10

Version

1.4.0

License

MIT

Unpacked Size

187 kB

Total Files

24

Last publish

Collaborators

  • pocketrocket