Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xpl committed Sep 27, 2017
2 parents adab38b + d9e2014 commit 8e96bb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A little helper for handling strings containing zero width characters, ANSI styling, whitespaces, newlines, etc.

## Determining real (visible) string length
## Determining the real (visible) length of a string

```javascript
const { strlen } = require ('printable-characters')
Expand All @@ -22,7 +22,7 @@ isBlank ('foobar') // === false
isBlank ('\u001b[106m \t \t \n \u001b[49m') // === true
```

## Obtaining blank string of the same width
## Obtaining a blank string of the same width

```javascript
const { blank } = require ('printable-characters')
Expand All @@ -43,7 +43,7 @@ s.replace (ansiEscapeCodes, '') // === 'foo\nbar'
.replace (zeroWidthCharacters, '') // === 'foobar'
```

## Getting first N visible symbols, preserving the invisible parts
## Getting the first N visible symbols, preserving the invisible parts

Use for safely truncating strings to maximum width without breaking ANSI codes:

Expand All @@ -58,7 +58,7 @@ first (s, 3) // === '\u001b[22mfoo\u001b[22m'
first (s, 6) // === '\u001b[22mfoobar\u001b[22m'
```

## Extracting invisible parts followed by visible ones (parsing)
## Extracting the invisible parts followed by the visible ones (parsing)

```javascript
const { partition } = require ('printable-characters')
Expand All @@ -74,5 +74,5 @@ partition ('\u001b[1mfoo\u0000bar\n') // [['\u001b[1m', 'foo'], ['\u0000', 'ba

- [as-table](https://github.com/xpl/as-table) — a simple function that prints objects as ASCII tables
- [string.bullet](https://github.com/xpl/string.bullet) — ASCII-mode bulleting for the list-style data
- [string.ify](https://github.com/xpl/string.ify) — a fancy pretty printer for JavaScript entities
- [string.ify](https://github.com/xpl/string.ify) — a fancy pretty printer for the JavaScript entities
- [Ololog!](https://github.com/xpl/ololog) — a better `console.log` for the log-driven debugging junkies!
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "printable-characters",
"version": "1.0.27",
"version": "1.0.29",
"description": "A little helper for handling strings containing zero width control characters, ANSI styling, whitespaces, newlines, etc.",
"main": "printable-characters.js",
"scripts": {
Expand Down

0 comments on commit 8e96bb5

Please sign in to comment.