icetool
Version:
Your fonctions friends
64 lines (51 loc) • 2.3 kB
Markdown
<div align="center">
<h1>iIceTools</h1>
<p>
<a href="https://www.npmjs.com/package/icetool"><img src="https://img.shields.io/npm/v/icetool?maxAge=3600" alt="NPM version" /></a>
<a href="https://www.npmjs.com/package/icetool"><img src="https://img.shields.io/npm/dt/icetool?maxAge=3600" alt="NPM downloads" /></a>
</p>
<p>
<a href="https://www.npmjs.com/package/icetool"><img src="https://nodei.co/npm/icetool.png?downloads=true&stars=true" alt="NPM Banner"></a>
</p>
</div>
- [Installation](
- [Example Usage](
```shContact
npm i icetool
```
```ts
import IceTools from 'icetool'; //Define the icetool module
```
```ts
import { NumberDateFormat } from 'icetool';
const dateFormat = new NumberDateFormat("us-US", {format: "MMMM Do YYYY, hh:mm:ss"});
dateFormat.format(Date.now()); // June 19th 2022, 18:05:01
```
```ts
import { NumberFormat } from 'icetool';
const compactNumberShort = new NumberFormat("us-US", {compactDisplay: "short", decimalNumber: 3, style: "none"});
compactNumberShort.format(1234567.891011); // 1.235M
const compactNumberLong = new NumberFormat("us-US", {compactDisplay: "long", decimalNumber: 3, style: "none"});
compactNumberLong.format(1234567.891011); // 1,234,567.891
const romanNumber = new NumberFormat("us-US", {style: "roman"});
romanNumber.format("XVII"); // 17
romanNumber.format(2408); // MMCDVIII
romanNumber.format(16780); // ↂↁMDCCLXXX
```
```ts
import { NumberTimeFormat } from 'icetool';
const shortTime = new NumberTimeFormat("us-US", {compactDisplay: "short", format: "End: HMS", separator: ", "});
shortTime.format(3738293); // End: 1h, 2m, 18s
const yearsTime = new NumberTimeFormat("us-US", {compactDisplay: "long", format: "Y MM W D H M S MS", separator: " |"});
yearsTime.format(Date.now()); // 52 years | 5 months | 2 weeks | 3 days | 21 hours | 44 minutes | 23 seconds | 528 milliseconds
const longTime = new NumberTimeFormat("us-US", {compactDisplay: "long"});
longTime.format("2h and 8m with 20s add 2day ... oh and 80ms"); // 180500080
```
Join the [Discord](https://discord.gg/gJycUt946D)