Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacobbubu/printable-string
Convert non-printable chars in string into their printable form.
https://github.com/jacobbubu/printable-string
Last synced: 2 months ago
JSON representation
Convert non-printable chars in string into their printable form.
- Host: GitHub
- URL: https://github.com/jacobbubu/printable-string
- Owner: jacobbubu
- Created: 2014-08-15T03:05:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-15T09:15:33.000Z (over 10 years ago)
- Last Synced: 2024-11-09T01:37:26.548Z (3 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 141 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
printable-string
================Convert non-printable chars in string into their printable form.
Installation
------------`npm install printable-string --save`
Usage
-----``` js
var print = require(printable-string)
console.log print("\x00 \t \v \u038b") // -> \x00 \t \v \u038b
console.log print("\x00 \t \v \u038b", {uppercase: true}) // -> \X00 \t \v \U038B
```Prefix `0x` will be used if the char code in ASCII range and the `\u` for the codes above 256.
Control codes will be converted to their literal expression as following:
```
0x07 -> '\a' // Bell
0x08 -> '\b' // Backspace
0x09 -> '\t' // Horizontal Tab
0x0a -> '\n' // Line feed
0x0b -> '\v' // Vertical Tab
0x0c -> '\f' // Form feed
0x0c -> '\r' // Carriage return
```