control-pictures

Replace pictures for control character codes with actual control characters

Usage no npm install needed!

<script type="module">
  import controlPictures from 'https://cdn.skypack.dev/control-pictures';
</script>

README

control-pictures

Build Coverage Downloads Size

Replace control pictures characters with actual control characters. Useful for example if you have tests with trailing spaces, or invisible control characters which you want to display, but also use.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install control-pictures

Use

import {controlPictures} from 'control-pictures'

controlPictures() //=> ''
controlPictures('␉␊␋␌␍') //=> '\t\n\v\f\r'
controlPictures('␀') //=> '\0'
controlPictures('a␡b') //=> 'a\x7fb'
controlPictures('␤') //=> '\n'

API

This package exports the following identifiers: controlPictures. There is no default export.

controlPictures(value?)

Replace control pictures with the actual control codes.

Supports U+2400 SYMBOL FOR NULL (␀) through U+2426 SYMBOL FOR SUBSTITUTE FORM TWO ().

Returns

string — Value but with actual control codes.

License

MIT © Titus Wormer