# to-fmt

> Convert literal template into formatter function

Latest version **1.0.2** (published 2018-04-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install to-fmt
pnpm add to-fmt
yarn add to-fmt
bun add to-fmt
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-04-26 |
| First published | 2018-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dev@rumk.in |
| Maintainers | rumkin |
| Keywords | format, formatter, templates |

## Links

- npm: https://www.npmjs.com/package/to-fmt
- Repository: https://github.com/rumkin/to-format
- Homepage: https://github.com/rumkin/to-format#readme
- Issues: https://github.com/rumkin/to-format/issues
- npm.io page: https://npm.io/package/to-fmt

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-04-26
- 1.0.1 — 2018-04-26
- 1.0.0 — 2018-04-20

## README

Convert template literal to formatter function.

[![npm](https://img.shields.io/npm/v/to-fmt.svg?style=flat-square)](https://npmjs.com/package/to-fmt)
[![Travis](https://img.shields.io/travis/rumkin/to-format.svg?style=flat-square)](https://travis-ci.org/rumkin/to-format)
![](https://img.shields.io/badge/coverage-100%25-green.svg?style=flat-square)
![](https://img.shields.io/badge/size-0.7%20KiB-blue.svg?style=flat-square)
![](https://img.shields.io/badge/deps-0-blue.svg?style=flat-square)
[![npm](https://img.shields.io/npm/dm/to-fmt.svg?style=flat-square)](https://npmjs.com/packages/to-fmt)

## Install

With npm:

```bash
npm i to-fmt
```

## Usage

Hello world example:

```javascript
import f from 'to-fmt';

const format = f`Hello, ${String}!`;

format('World'); // -> 'Hello, World!'
```

Number formatter:

```javascript
import f from 'to-fmt';

const toFixed = n => number => number.toFixed(n);

const format = f`Value is ${toFixed(2)}!`;

format(1); // -> 'Value is 1.00!'
format(3.14159); // -> 'Value is 3.14!'
```

Multiple values example:
```javascript
import f from 'to-fmt';
import bytes from 'pretty-bytes';

const format = f`"${String}" size is ${bytes}!`;

format('index.js', 605); // -> '"index.js" size is 605 B'
```

## License

MIT.

## Copyright

&copy; 2018, Rumkin.

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