https://github.com/floatdrop/pff
Minimal implementation of printf, which is really fast
https://github.com/floatdrop/pff
Last synced: 7 months ago
JSON representation
Minimal implementation of printf, which is really fast
- Host: GitHub
- URL: https://github.com/floatdrop/pff
- Owner: floatdrop
- License: mit
- Created: 2014-06-18T16:37:40.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-12-04T06:40:43.000Z (over 10 years ago)
- Last Synced: 2025-10-05T00:18:45.952Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 28
- Watchers: 0
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# pff [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
> Minimal printf implementation
__No more words, show me the numbers!__

Run yourself to get numbers relevant to your hardware:
```bash
$ npm i -g matcha printf sprint
$ npm i
$ matcha benchmark/index.js
```
## Usage
```js
var pff = require('pff');
console.log(pff('%s world from %d year!', 'Hello', 2014.7));
// Hello world from 2014 year!
```
## Specifiers
| Specifier | What it does | Example | Result |
| ------------: | --------------------- | --------------------------- | ---------------- |
| **%s** | String | `pff('Hello %s', 'world')` | `'Hello world'` |
| **%d** | Floored number | `pff('My age is %d', 13.2)` | `'My age is 13'` |
| **%%** | Percent | `pff('100%%s cool!')` | `'100%s cool!'` |
Not much, but hey! - it's fast!
# License
MIT (c) 2014 Vsevolod Strukchinsky (floatdrop@gmail.com)
[npm-url]: https://npmjs.org/package/pff
[npm-image]: http://img.shields.io/npm/v/pff.svg
[travis-url]: https://travis-ci.org/floatdrop/pff
[travis-image]: http://img.shields.io/travis/floatdrop/pff.svg