# ffformat

> ![logo](./ffformat_logo.png)

Latest version **1.3.1** (published 2020-11-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install ffformat
pnpm add ffformat
yarn add ffformat
bun add ffformat
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2020-11-08 |
| First published | 2020-04-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 35.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Maintainers | wuli.croatia |
| Keywords | data, format |

## Links

- npm: https://www.npmjs.com/package/ffformat
- Repository: https://github.com/CroatiaParanoia/ffformat
- Homepage: https://github.com/CroatiaParanoia/ffformat#readme
- Issues: https://github.com/CroatiaParanoia/ffformat/issues
- npm.io page: https://npm.io/package/ffformat

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.3.1 (latest) — 2020-11-08
- 1.3.0 — 2020-11-07
- 1.2.0 — 2020-10-21
- 1.1.2-5 — 2020-10-21
- 1.0.6 — 2020-04-21
- 1.0.5-alpha.12 — 2020-04-21
- 1.0.5-alpha.11 — 2020-04-21
- 1.0.5-alpha.10 — 2020-04-21
- 1.0.5-alpha.8 — 2020-04-21
- 1.0.5-alpha.7 — 2020-04-21
- 1.0.5-alpha.4 — 2020-04-21
- 1.0.5-alpha.3 — 2020-04-21
- 1.0.5-alpha.2 — 2020-04-21
- 1.0.5-alpha.0 — 2020-04-21
- 1.0.4 — 2020-04-21
- … 3 more at https://npm.io/package/ffformat/versions

## README

![logo](./ffformat_logo.png)

## ffformat
- 数据格式化，数据源 + 类型 = 完全新的格式化后数据。
- 暂只支持 `string`、`number`、`boolean`、`object` 和 `array`。


### 为啥子要用
- 一般情况下用不到， 除非对后端有些怨言...

![description](./description.jpg)

### 安装
```
yarn add ffformat 
```

### 使用
``` typescript
import { typeCreator as T, format } from 'ffformat';
// =============== basic usage =============
format('croatia', T.string());
// 'croatia'

format(21, T.string());
// '21'

format(null, T.string());
// ''

format(null, T.string('croatia'));
// 'croatia'


// ============== mixed usage =============
format(
  { name: 'croatia', age: '21', skillId: ['1', '2', '3', '4'] },
  T.object({ name: T.string(), age: T.number(), skillId: T.array(T.number()) })
);
// {
//    name: 'croatia',
//    age: 21,
//    skillId: [1, 2, 3, 4]
//  }
);

```
更多示例， 看 [format/\_\_tests\_\_/format.test.ts](https://github.com/CroatiaParanoia/ffformat/blob/master/src/format/__tests__/format.test.ts)

---
_Source: https://npm.io/package/ffformat · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
