string-true-oneline
v1.0.0
Published
This module transforms a string to a oneline string considering escape sequences: so('test noop test') -> 'noop test'
Downloads
63
Maintainers
Readme
string-true-oneline
This module is written on
typescript
, and contains the.d.ts
file. If you write ontypescript
: just use it in your project and definitions will be automatically uploaded.
npm i -S string-true-oneline
About
This module transforms a string to a oneline string considering escape sequences.
Warning!
This module does not supported an ANSI escape codes. And simply removes them before forming line.
const so = require('string-true-oneline')
const inspect = require('util').inspect
const assert = require('assert')
const chalk = require('chalk')
const actColor = so(chalk.blue('\nhello') + ' ' + chalk.blue('world!\n'))
const actClear = so('\nhello world!\n')
const exp = 'hello world!'
assert.equal(actColor, exp)
assert.equal(actClear, exp)
Examples
const so = require('string-true-oneline')
const inspect = require('util').inspect
const assert = require('assert')
var act = so(' \n hello world! \n ')
var exp = 'hello world!'
assert.equal(act, exp)
var act = so('h\ve\vl\rl\f\bo \nw\no\r\v\r\vr\v\rl\nd !')
var exp = 'h e l l o w o r l d !'
assert.equal(act, exp)
Related
- string-render - base module
- murky - like util.format with additional placeholders