-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme
- Loading branch information
Showing
2 changed files
with
22 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# function-formatter | ||
# terse-format | ||
|
||
[![NPM version][npm-image]][npm-url] | ||
[![NPM downloads][downloads-image]][downloads-url] | ||
[![Build status][travis-image]][travis-url] | ||
[![Coverage Status][coveralls-image]][coveralls-url] | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/unional/function-formatter.svg)](https://greenkeeper.io/) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/unional/terse-format.svg)](https://greenkeeper.io/) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
|
||
Format function to a compact form. | ||
Format object tersely. | ||
|
||
The `toString()` of function may result in a multiline string. | ||
`toString()`, `JSON.stringify()` and even [`stringify-object`](https://github.com/yeoman/stringify-object) can return multieline strings. | ||
|
||
This library will return a single line instead. | ||
If the function is too long, it will be trimmed (default to 120). | ||
If the object or function is too long, it will be trimmed (default to 120). | ||
|
||
```ts | ||
import { formatFunction } from 'function-formatter' | ||
import { formatFunction, formatObject } from 'terse-format' | ||
|
||
// () => 'foo' | ||
formatFunction(() => 'foo') | ||
|
@@ -26,6 +26,9 @@ formatFunction(function (x, y) { return x + y }) | |
// Change result to 80 character long. | ||
// result will have `...` to indicate info missing. | ||
formatFunction(..., { maxLength: 80 }) | ||
|
||
// '{ a: 1 }` | ||
formatObject({ a: 1 }) | ||
``` | ||
|
||
## Contribute | ||
|
@@ -77,11 +80,11 @@ Generated by `[email protected]` | |
|
||
- [ ] work on browser | ||
|
||
[npm-image]: https://img.shields.io/npm/v/function-formatter.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/function-formatter | ||
[downloads-image]: https://img.shields.io/npm/dm/function-formatter.svg?style=flat | ||
[downloads-url]: https://npmjs.org/package/function-formatter | ||
[travis-image]: https://img.shields.io/travis/unional/function-formatter/master.svg?style=flat | ||
[travis-url]: https://travis-ci.org/unional/function-formatter?branch=master | ||
[coveralls-image]: https://coveralls.io/repos/github/unional/function-formatter/badge.svg | ||
[coveralls-url]: https://coveralls.io/github/unional/function-formatter | ||
[npm-image]: https://img.shields.io/npm/v/terse-format.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/terse-format | ||
[downloads-image]: https://img.shields.io/npm/dm/terse-format.svg?style=flat | ||
[downloads-url]: https://npmjs.org/package/terse-format | ||
[travis-image]: https://img.shields.io/travis/unional/terse-format/master.svg?style=flat | ||
[travis-url]: https://travis-ci.org/unional/terse-format?branch=master | ||
[coveralls-image]: https://coveralls.io/repos/github/unional/terse-format/badge.svg | ||
[coveralls-url]: https://coveralls.io/github/unional/terse-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters