@nits.frontend/number-utils
TypeScript icon, indicating that this package has built-in type declarations

1.1.8 • Public • Published

With npm

 npm install @nits.frontend/number-utils --save

With yarn

yarn add @nits.frontend/number-utils

#EXAMPLE

const { addSpaceEvery3Char } = require("@nits.frontend/number-utils");

ES2015;

import { addSpaceEvery3Char } from "@nits.frontend/number-utils";

const result = addSpaceEvery3Char({ num: 1234567, count: 2 });

console.log(result);

// 1 234 567,00

const result = addSpaceEvery3Char({ num: 1234567, count: 3 });

console.log(result);

// 1 234 567,000

const result = addSpaceEvery3Char({ num: 1234567, separator: "_" });

console.log(result);

// 1_234_567,00

const result = addSpaceEvery3Char({
  num: 1234567,
  separator: "_",
  decimal: ".",
});

console.log(result);

// 1_234_567.00

const result = addSpaceEvery3Char({
  num: [],
  defaultValue: "this is not I want",
});

// this is not I want

#EXAMPLE

const { createRangeAndDoSomething } = require("@nits.frontend/number-utils");

ES2015;

import { createRangeAndDoSomething } from "@nits.frontend/number-utils";

createRangeAndDoSomething(4, 5, (i) => {
  console.log(i);
});

// 4,5

DEFINITION

Parameter Value
num required
count default: 2
separator default: " "
decimal default: ","
defaultValue default: "invalid number"

Package Sidebar

Install

npm i @nits.frontend/number-utils

Weekly Downloads

15

Version

1.1.8

License

ISC

Unpacked Size

3.45 kB

Total Files

8

Last publish

Collaborators

  • xikmatilla
  • temurbekh
  • oybek_kamolov
  • invuln
  • furqat
  • akbar_1909