Skip to content

Commit

Permalink
feat: rename to terse-format
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
unional committed Nov 26, 2017
1 parent 015f2f0 commit ba5b946
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
31 changes: 17 additions & 14 deletions README.md
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')
Expand All @@ -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
Expand Down Expand Up @@ -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
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "function-formatter",
"description": "Format function to a compact form",
"name": "tarse-format",
"description": "Format object tersely",
"version": "0.0.0-development",
"main": "dist-es5/index.js",
"module": "dist-es2015/index.js",
Expand Down Expand Up @@ -30,12 +30,12 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/unional/function-formatter.git"
"url": "https://github.com/unional/terse-format.git"
},
"bugs": {
"url": "https://github.com/unional/function-formatter/issues"
"url": "https://github.com/unional/terse-format/issues"
},
"homepage": "https://github.com/unional/function-formatter",
"homepage": "https://github.com/unional/terse-format",
"ava": {
"files": [
"dist-es2015/**/*.spec.js"
Expand Down

0 comments on commit ba5b946

Please sign in to comment.