diff --git a/README.md b/README.md index 55ddbe7..ddbabb1 100644 --- a/README.md +++ b/README.md @@ -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 `generator-unional@0.0.1` - [ ] 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 diff --git a/package.json b/package.json index 8b3a1cb..f580c34 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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"