open-index/open-npm huggingface dataset:
npm package: 114k.js
Description: 114k.js is a lightweight number abbreviation library.
Author: anzai249
Latest version: 0.1.3
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# 114k.js

A a lightweight number abbreviation library.

## Get Started

### Install

Using npm:

```bash
npm i 114k.js
```

Using `<script>`

```html
<script src="format114k.global.js"></script>
```

### Usage

```js
import { abbreviateNumber, formatNumber } from "114k.js"

console.log(abbreviateNumber(114514)); // 114.5k
console.log(formatNumber(114514)); // 114,514

```

or

```js
console.log(format114k.abbreviateNumber(114514)); // 114.5k
console.log(format114k.formatNumber(114514)); // 114,514
```

## APIs

### `formatNumber(num: Number): String`

Get the formatted number like `114,514`

#### Params

##### `num: Number`

The number to be formatted.

### `abbreviateNumber(num: Number, digits?: Number, rounding?: String, locale?: String): String`

#### Params

##### `num: Number`

The number to be abbreviated.

##### `digits?: Number`

Number of decimal places to be retained. **An integer is required.**

Default: `1`

##### `rounding?: String`

Rounding method.

Default: `"round"`

Possible options:

- `"round"`
- `"ceil"`
- `"floor"`

##### `locale?: String`

Language of the abbreviated number.

Default: `"en"`

Possible options:

- `"en"` // k, M, B, T...
- `"ru"` // тыс., млн...
- `"zh-CN"` // 万, 亿, 万亿...
- `"zh-TW"` // 萬, 億, 兆, 京...
- `"ja"` // 万, 億, 兆, 京...
- `"ko"` // 만, 억, 조, 경...
- `"vi"` // nghìn, tỷ, nghìn tỷ

Maximum Numbers:

- Maximum `num` of zh-CN, zh-TW, ja and ko is 1e25-1.
- Maximum `num` of en and ru is 1e16-1.
- Maximum `num` of vi is 1e13-1.

## Examples

```js
console.log(
    `The population of India in 2023 was ${formatNumber(1428627663)}, about ${abbreviateNumber(1428627663, 2, "round", "en")} people.`
)
// The population of India in 2023 was 1,428,627,663, about 1.43B people.
```

```js
console.log(
    `台灣共有${abbreviateNumber(36197, 2, "round", "zh-TW")}平方千米的土地。`
)
// 台灣共有3.62萬平方千米的土地。
```

```js
console.log(
    `中国大陆在约${abbreviateNumber(9596961, 2, "round", "zh-CN")}平方千米的土地中塞入了约${abbreviateNumber(1426389855, 2, "round", "zh-CN")}的人口。`
)
// 中国大陆在约959.7万平方千米的土地中塞入了约14.26亿的人口。
```
npm package: 115open
Description: 115开放平台 JS/TS SDK，支持 Node.js、Vue、React。中英文注释，单元测试，CI集成。115 Open Platform JS/TS SDK for Node.js, Vue, React. With Chinese/English comments, unit tests, CI integration.
Author: 尘墨成
Latest version: 1.0.1

[English README](./README.md)

# 115开放平台 JS/TS SDK

115开放平台 JS/TS SDK，支持 Node.js、Vue、React。支持设备码授权、二维码登录、Token 管理、用户信息、文件管理、离线下载等功能。基于官方开发文档实现。

---

## 特性
- 设备码授权
- 二维码登录
- Token 获取与刷新
- 用户信息获取
- 文件管理
- 离线下载

---

## 安装

```bash
npm install 115open
# 或
yarn add 115open
```

---

## 快速上手

```js
import { Client } from '115open';
const client = new Client('your_client_id');
// 设备码授权
const authUrl = client.auth.getDeviceCodeUrl();
// 获取用户信息
const user = await client.user.getInfo();
```

---

## 主要API示例

```js
// 文件列表
const files = await client.fileManager.list();

// 离线下载
await client.offline.addTask(url);
```

---

## 贡献
欢迎提交 issue 和 PR！

---

## 许可证
MIT