JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q12086F
  • License GPL

Normalize the numbers for uniform distribution

Package Exports

  • number-normalizer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (number-normalizer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Introduction

Normalize a number for uniform distribution with in an uneven distributed series of numbers.

Strings will be returned as it is without any change.

Usage

Install

npm install number-normalizer

Example

var nNorm = require('number-normalizer');

var nVal = nNorm.normalize(10);
// returns 2.302585092994046

nVal = nNorm.normalize("100");
// returns 4.605170185988092

var list = nNorm.normalizeAll([0,-1,1,2,-3,3,-3.1,20000,300000, 'a', 'b']);
/* returns
[ 0,
  -1,
  1,
  0.6931471805599453,
  -1.0986122886681098,
  1.0986122886681098,
  -1.1314021114911006,
  9.903487552536127,
  12.611537753638338,
  'a',
  'b']
*/

nVal = nNorm.normalize(100, 3);
// returns 4.605

var list = nNorm.normalizeAll([0,-1,1,2,-3,3,-3.1,20000,300000], 3);
// returns [ 0, -1, 1, '0.693', -1.099, '1.099', -1.131, '9.903', '12.612' ]