Nominally Patriotic Meathead
Miss any of our Open RFC calls?Watch the recordings here! »

@theoryofnekomata/normalize-exponential

1.0.1 • Public • Published

normalize-exponential

Normalizes exponential format in float-parseable strings.

Why?

If, for example, you want to work on floating point values without needing to parse it (as it loses the precision), and you want to be able to represent your values into an exponential notation, you'll need something like this package.

Installation

Via NPM:

$ npm install --save @theoryofnekomata/normalize-exponential

Usage

var normalizeExp = require('@theoryofnekomata/normalize-exponential');
 
var floatStr = '00003453.654345000e+34',
    normalizedFloat = normalizeExp(floatStr); // returns 3.453654345e+37
 
// ...

Notes

It enforces the output to be in lowercase (i.e. 'e' instead of 'E').

Contribution

Sure thing! Just clone the repo.

to-sass-value uses Jasmine for unit tests, and ESLint to make sure code is written consistently (and implied it will run consistently as well).

  • Run npm install upon initial clone.
  • Run npm test and make sure all the tests pass and properly written.
  • Run npm run lint to ensure consistency of your code (make sure to install ESLint first).
  • Create PRs so that I can confirm and merge your contributions.

Please star the repo if you find it useful in your projects.

License

MIT. See LICENSE file for details.

Install

npm i @theoryofnekomata/normalize-exponential

DownloadsWeekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avatar