JSPM

string-true-oneline

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q46900F
  • License MIT

This module transforms a string to a oneline string considering escape sequences: so('test noop test') -> 'noop test'

Package Exports

  • string-true-oneline

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string-true-oneline) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

string-true-oneline

Build Status Coverage Status

This module is written on typescript, and contains the .d.ts file.
If you write on typescript: 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)