lesca-number
TypeScript icon, indicating that this package has built-in type declarations

1.5.9 • Public • Published

React React React React React NPM React NPM

Why use it?

some useful calculation formula.

Installation

npm install lesca-number --save

Usage

As a Node module:

import {
  Pad,
  Uid,
  Dollar,
  CoverSize,
} from 'lesca-number';

for (var i = 0; i < 100; i++) {
  let img_url = `./${Pad(i, 4)}.png`;
  console.log(img_url); // => 0001.png ~ 0100.png
}

console.log(Uid(10)); // => c38c995b8d (random)
console.log(Dollar(93848421100)); // => 93,848,421,100
console.log(CoverSize({ width: 720, height: 420 }, { width: 1000, height: 1000 }));

Development

method description default
.Pad(num:int, max:int):string the index of numbers max = 4
.Uid(len:int):string length of numbers 10
.Dollar(num:int):string 1130200 => 1,130,200
.CoverSize(imageSize:object, containerSize:object):object calculator cover size

Features

  • maintain if necessary

Readme

Keywords

Package Sidebar

Install

npm i lesca-number

Weekly Downloads

4

Version

1.5.9

License

MIT

Unpacked Size

392 kB

Total Files

33

Last publish

Collaborators

  • jameshsu1125