Initial commit, 90% there
This commit is contained in:
1
node_modules/wordwrapjs/.npmignore
generated
vendored
Normal file
1
node_modules/wordwrapjs/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tmp
|
||||
7
node_modules/wordwrapjs/.travis.yml
generated
vendored
Normal file
7
node_modules/wordwrapjs/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 8
|
||||
- 7
|
||||
- 6
|
||||
- 5
|
||||
- 4
|
||||
21
node_modules/wordwrapjs/LICENSE
generated
vendored
Normal file
21
node_modules/wordwrapjs/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-17 Lloyd Brookes <75pound@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
114
node_modules/wordwrapjs/README.md
generated
vendored
Normal file
114
node_modules/wordwrapjs/README.md
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
[](https://www.npmjs.org/package/wordwrapjs)
|
||||
[](https://www.npmjs.org/package/wordwrapjs)
|
||||
[](https://travis-ci.org/75lb/wordwrapjs)
|
||||
[](https://david-dm.org/75lb/wordwrapjs)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
# wordwrapjs
|
||||
|
||||
Word wrapping, with a few features.
|
||||
|
||||
- force-break option
|
||||
- wraps hypenated words
|
||||
- multilingual - wraps any language that uses whitespace for word separation.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Wrap some text in a 20 character column.
|
||||
|
||||
```js
|
||||
> wordwrap = require('wordwrapjs')
|
||||
|
||||
> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
||||
|
||||
> result = wordwrap.wrap(text, { width: 20 })
|
||||
```
|
||||
|
||||
`result` now looks like this:
|
||||
```
|
||||
Lorem ipsum dolor
|
||||
sit amet,
|
||||
consectetur
|
||||
adipiscing elit, sed
|
||||
do eiusmod tempor
|
||||
incididunt ut labore
|
||||
et dolore magna
|
||||
aliqua.
|
||||
```
|
||||
|
||||
By default, long words will not break. Unless you set the `break` option.
|
||||
```js
|
||||
> url = 'https://github.com/75lb/wordwrapjs'
|
||||
|
||||
> wrap.lines(url, { width: 18 })
|
||||
[ 'https://github.com/75lb/wordwrapjs' ]
|
||||
|
||||
> wrap.lines(url, { width: 18, break: true })
|
||||
[ 'https://github.com', '/75lb/wordwrapjs' ]
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
|
||||
* [wordwrapjs](#module_wordwrapjs)
|
||||
* [WordWrap](#exp_module_wordwrapjs--WordWrap) ⏏
|
||||
* [.wrap(text, [options])](#module_wordwrapjs--WordWrap.wrap) ⇒ <code>string</code>
|
||||
* [.lines(text, options)](#module_wordwrapjs--WordWrap.lines)
|
||||
* [.isWrappable(text)](#module_wordwrapjs--WordWrap.isWrappable) ⇒ <code>boolean</code>
|
||||
* [.getChunks(text)](#module_wordwrapjs--WordWrap.getChunks) ⇒ <code>Array.<string></code>
|
||||
|
||||
<a name="exp_module_wordwrapjs--WordWrap"></a>
|
||||
|
||||
### WordWrap ⏏
|
||||
**Kind**: Exported class
|
||||
<a name="module_wordwrapjs--WordWrap.wrap"></a>
|
||||
|
||||
#### WordWrap.wrap(text, [options]) ⇒ <code>string</code>
|
||||
**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| text | <code>string</code> | the input text to wrap |
|
||||
| [options] | <code>object</code> | optional configuration |
|
||||
| [options.width] | <code>number</code> | the max column width in characters (defaults to 30). |
|
||||
| [options.break] | <code>boolean</code> | if true, words exceeding the specified `width` will be forcefully broken |
|
||||
| [options.noTrim] | <code>boolean</code> | By default, each line output is trimmed. If `noTrim` is set, no line-trimming occurs - all whitespace from the input text is left in. |
|
||||
|
||||
<a name="module_wordwrapjs--WordWrap.lines"></a>
|
||||
|
||||
#### WordWrap.lines(text, options)
|
||||
Wraps the input text, returning an array of strings (lines).
|
||||
|
||||
**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| text | <code>string</code> | input text |
|
||||
| options | <code>object</code> | Accepts same options as constructor. |
|
||||
|
||||
<a name="module_wordwrapjs--WordWrap.isWrappable"></a>
|
||||
|
||||
#### WordWrap.isWrappable(text) ⇒ <code>boolean</code>
|
||||
Returns true if the input text would be wrapped if passed into `.wrap()`.
|
||||
|
||||
**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| text | <code>string</code> | input text |
|
||||
|
||||
<a name="module_wordwrapjs--WordWrap.getChunks"></a>
|
||||
|
||||
#### WordWrap.getChunks(text) ⇒ <code>Array.<string></code>
|
||||
Splits the input text into an array of words and whitespace.
|
||||
|
||||
**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| text | <code>string</code> | input text |
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
© 2015-17 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||
149
node_modules/wordwrapjs/index.js
generated
vendored
Normal file
149
node_modules/wordwrapjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
'use strict'
|
||||
const os = require('os')
|
||||
const t = require('typical')
|
||||
|
||||
/**
|
||||
* @module wordwrapjs
|
||||
*/
|
||||
|
||||
const re = {
|
||||
chunk: /[^\s-]+?-\b|\S+|\s+|\r\n?|\n/g,
|
||||
ansiEscapeSequence: /\u001b.*?m/g
|
||||
}
|
||||
|
||||
/**
|
||||
* @alias module:wordwrapjs
|
||||
* @typicalname wordwrap
|
||||
*/
|
||||
class WordWrap {
|
||||
constructor (text, options) {
|
||||
options = options || {}
|
||||
if (!t.isDefined(text)) text = ''
|
||||
|
||||
this._lines = String(text).split(/\r\n|\n/g)
|
||||
this.options = options
|
||||
this.options.width = options.width === undefined ? 30 : options.width
|
||||
}
|
||||
|
||||
lines () {
|
||||
const flatten = require('reduce-flatten')
|
||||
|
||||
/* trim each line of the supplied text */
|
||||
return this._lines.map(trimLine.bind(this))
|
||||
|
||||
/* split each line into an array of chunks, else mark it empty */
|
||||
.map(line => line.match(re.chunk) || [ '~~empty~~' ])
|
||||
|
||||
/* optionally, break each word on the line into pieces */
|
||||
.map(lineWords => {
|
||||
if (this.options.break) {
|
||||
return lineWords.map(breakWord.bind(this))
|
||||
} else {
|
||||
return lineWords
|
||||
}
|
||||
})
|
||||
.map(lineWords => lineWords.reduce(flatten, []))
|
||||
|
||||
/* transforming the line of words to one or more new lines wrapped to size */
|
||||
.map(lineWords => {
|
||||
return lineWords
|
||||
.reduce((lines, word) => {
|
||||
let currentLine = lines[lines.length - 1]
|
||||
if (replaceAnsi(word).length + replaceAnsi(currentLine).length > this.options.width) {
|
||||
lines.push(word)
|
||||
} else {
|
||||
lines[lines.length - 1] += word
|
||||
}
|
||||
return lines
|
||||
}, [ '' ])
|
||||
})
|
||||
.reduce(flatten, [])
|
||||
|
||||
/* trim the wrapped lines */
|
||||
.map(trimLine.bind(this))
|
||||
|
||||
/* filter out empty lines */
|
||||
.filter(line => line.trim())
|
||||
|
||||
/* restore the user's original empty lines */
|
||||
.map(line => line.replace('~~empty~~', ''))
|
||||
}
|
||||
|
||||
wrap () {
|
||||
return this.lines().join(os.EOL)
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.wrap()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} - the input text to wrap
|
||||
* @param [options] {object} - optional configuration
|
||||
* @param [options.width] {number} - the max column width in characters (defaults to 30).
|
||||
* @param [options.break] {boolean} - if true, words exceeding the specified `width` will be forcefully broken
|
||||
* @param [options.noTrim] {boolean} - By default, each line output is trimmed. If `noTrim` is set, no line-trimming occurs - all whitespace from the input text is left in.
|
||||
* @return {string}
|
||||
*/
|
||||
static wrap (text, options) {
|
||||
const block = new this(text, options)
|
||||
return block.wrap()
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the input text, returning an array of strings (lines).
|
||||
* @param {string} - input text
|
||||
* @param {object} - Accepts same options as constructor.
|
||||
*/
|
||||
static lines (text, options) {
|
||||
const block = new this(text, options)
|
||||
return block.lines()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the input text would be wrapped if passed into `.wrap()`.
|
||||
* @param {string} - input text
|
||||
* @return {boolean}
|
||||
*/
|
||||
static isWrappable (text) {
|
||||
if (t.isDefined(text)) {
|
||||
text = String(text)
|
||||
var matches = text.match(re.chunk)
|
||||
return matches ? matches.length > 1 : false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the input text into an array of words and whitespace.
|
||||
* @param {string} - input text
|
||||
* @returns {string[]}
|
||||
*/
|
||||
static getChunks (text) {
|
||||
return text.match(re.chunk) || []
|
||||
}
|
||||
}
|
||||
|
||||
function trimLine (line) {
|
||||
return this.options.noTrim ? line : line.trim()
|
||||
}
|
||||
|
||||
function replaceAnsi (string) {
|
||||
return string.replace(re.ansiEscapeSequence, '')
|
||||
}
|
||||
|
||||
/* break a word into several pieces */
|
||||
function breakWord (word) {
|
||||
if (replaceAnsi(word).length > this.options.width) {
|
||||
const letters = word.split('')
|
||||
let piece
|
||||
const pieces = []
|
||||
while ((piece = letters.splice(0, this.options.width)).length) {
|
||||
pieces.push(piece.join(''))
|
||||
}
|
||||
return pieces
|
||||
} else {
|
||||
return word
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WordWrap
|
||||
60
node_modules/wordwrapjs/jsdoc2md/README.hbs
generated
vendored
Normal file
60
node_modules/wordwrapjs/jsdoc2md/README.hbs
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
[](https://www.npmjs.org/package/wordwrapjs)
|
||||
[](https://www.npmjs.org/package/wordwrapjs)
|
||||
[](https://travis-ci.org/75lb/wordwrapjs)
|
||||
[](https://david-dm.org/75lb/wordwrapjs)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
# wordwrapjs
|
||||
|
||||
Word wrapping, with a few features.
|
||||
|
||||
- force-break option
|
||||
- wraps hypenated words
|
||||
- multilingual - wraps any language that uses whitespace for word separation.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Wrap some text in a 20 character column.
|
||||
|
||||
```js
|
||||
> wordwrap = require('wordwrapjs')
|
||||
|
||||
> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
||||
|
||||
> result = wordwrap.wrap(text, { width: 20 })
|
||||
```
|
||||
|
||||
`result` now looks like this:
|
||||
```
|
||||
Lorem ipsum dolor
|
||||
sit amet,
|
||||
consectetur
|
||||
adipiscing elit, sed
|
||||
do eiusmod tempor
|
||||
incididunt ut labore
|
||||
et dolore magna
|
||||
aliqua.
|
||||
```
|
||||
|
||||
By default, long words will not break. Unless you set the `break` option.
|
||||
```js
|
||||
> url = 'https://github.com/75lb/wordwrapjs'
|
||||
|
||||
> wrap.lines(url, { width: 18 })
|
||||
[ 'https://github.com/75lb/wordwrapjs' ]
|
||||
|
||||
> wrap.lines(url, { width: 18, break: true })
|
||||
[ 'https://github.com', '/75lb/wordwrapjs' ]
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
{{#module name="wordwrapjs"}}
|
||||
{{>body~}}
|
||||
{{>member-index~}}
|
||||
{{>members~}}
|
||||
{{/module}}
|
||||
|
||||
* * *
|
||||
|
||||
© 2015-17 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||
31
node_modules/wordwrapjs/package.json
generated
vendored
Normal file
31
node_modules/wordwrapjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "wordwrapjs",
|
||||
"author": "Lloyd Brookes <75pound@gmail.com>",
|
||||
"version": "3.0.0",
|
||||
"description": "Word-wrapping for javascript.",
|
||||
"repository": "https://github.com/75lb/wordwrapjs.git",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"word",
|
||||
"line",
|
||||
"wrap",
|
||||
"text",
|
||||
"columns",
|
||||
"wordwrap"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js",
|
||||
"docs": "jsdoc2md -t jsdoc2md/README.hbs index.js > README.md; echo"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jsdoc-to-markdown": "^3.0.0",
|
||||
"test-runner": "~0.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"reduce-flatten": "^1.0.1",
|
||||
"typical": "^2.6.1"
|
||||
}
|
||||
}
|
||||
190
node_modules/wordwrapjs/test.js
generated
vendored
Normal file
190
node_modules/wordwrapjs/test.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
'use strict'
|
||||
const TestRunner = require('test-runner')
|
||||
const wordwrap = require('./')
|
||||
const a = require('assert')
|
||||
|
||||
const runner = new TestRunner()
|
||||
const bars = "I'm rapping. I'm rapping. I'm rap rap rapping. I'm rap rap rap rap rappity rapping."
|
||||
|
||||
runner.test('simple', function () {
|
||||
a.strictEqual(
|
||||
wordwrap.wrap(bars),
|
||||
"I'm rapping. I'm rapping. I'm\nrap rap rapping. I'm rap rap\nrap rap rappity rapping."
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('width', function () {
|
||||
a.strictEqual(
|
||||
wordwrap.wrap(bars, { width: 3 }),
|
||||
"I'm\nrapping.\nI'm\nrapping.\nI'm\nrap\nrap\nrapping.\nI'm\nrap\nrap\nrap\nrap\nrappity\nrapping."
|
||||
)
|
||||
})
|
||||
|
||||
runner.skip('ignore', function () {
|
||||
a.strictEqual(
|
||||
wrap(bars, { ignore: "I'm" }),
|
||||
"I'm rapping. I'm rapping. I'm rap rap\nrapping. I'm rap rap rap rap\nrappity rapping."
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('wordwrap.lines', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines(bars),
|
||||
[ "I'm rapping. I'm rapping. I'm",
|
||||
"rap rap rapping. I'm rap rap",
|
||||
'rap rap rappity rapping.' ]
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('wordwrap.lines, width', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines(bars, { width: 3 }),
|
||||
[ "I'm",
|
||||
'rapping.',
|
||||
"I'm",
|
||||
'rapping.',
|
||||
"I'm",
|
||||
'rap',
|
||||
'rap',
|
||||
'rapping.',
|
||||
"I'm",
|
||||
'rap',
|
||||
'rap',
|
||||
'rap',
|
||||
'rap',
|
||||
'rappity',
|
||||
'rapping.' ]
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('wordwrap.lines, width smaller than content width', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('4444', { width: 3 }),
|
||||
[ '4444' ]
|
||||
)
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('onetwothreefour fivesixseveneight', { width: 7 }),
|
||||
[ 'onetwothreefour', 'fivesixseveneight' ]
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('wordwrap.lines, break', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('onetwothreefour', { width: 7, break: true }),
|
||||
[ 'onetwot', 'hreefou', 'r' ]
|
||||
)
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('\u001b[4m--------\u001b[0m', { width: 10, break: true, ignore: /\u001b.*?m/g }),
|
||||
[ '\u001b[4m--------\u001b[0m' ]
|
||||
)
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines(
|
||||
'onetwothreefour fivesixseveneight',
|
||||
{ width: 7, break: true }
|
||||
),
|
||||
[ 'onetwot', 'hreefou', 'r', 'fivesix', 'sevenei', 'ght' ]
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('wordwrap.lines(text): respect existing linebreaks', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('one\ntwo three four', { width: 8 }),
|
||||
[ 'one', 'two', 'three', 'four' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('one \n \n two three four', { width: 8 }),
|
||||
[ 'one', '', 'two', 'three', 'four' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('one\r\ntwo three four', { width: 8 }),
|
||||
[ 'one', 'two', 'three', 'four' ]
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('wordwrap.lines(text): multilingual', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('Può parlare più lentamente?', { width: 10 }),
|
||||
[ 'Può', 'parlare', 'più', 'lentamente?' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('один два три', { width: 4 }),
|
||||
[ 'один', 'два', 'три' ]
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('wrap hyphenated words', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('ones-and-twos', { width: 5 }),
|
||||
[ 'ones-', 'and-', 'twos' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('ones-and-twos', { width: 10 }),
|
||||
[ 'ones-and-', 'twos' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('--------', { width: 5 }),
|
||||
[ '--------' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('--one --fifteen', { width: 5 }),
|
||||
[ '--one', '--fifteen' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('one-two', { width: 10 }),
|
||||
[ 'one-two' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('ansi-escape-sequences', { width: 22 }),
|
||||
[ 'ansi-escape-sequences' ]
|
||||
)
|
||||
|
||||
a.deepStrictEqual(
|
||||
wordwrap.lines('one - two'),
|
||||
[ 'one - two' ]
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('isWrappable(input)', function () {
|
||||
a.strictEqual(wordwrap.isWrappable('one two'), true)
|
||||
a.strictEqual(wordwrap.isWrappable('one-two'), true)
|
||||
a.strictEqual(wordwrap.isWrappable('one\ntwo'), true)
|
||||
})
|
||||
|
||||
runner.test('getChunks', function () {
|
||||
a.deepStrictEqual(wordwrap.getChunks('one two three'), [ 'one', ' ', 'two', ' ', 'three' ])
|
||||
})
|
||||
|
||||
runner.test('noTrim', function () {
|
||||
a.deepStrictEqual(wordwrap.lines('word\n - word\n - word'), [
|
||||
'word', '- word', '- word'
|
||||
])
|
||||
a.deepStrictEqual(wordwrap.lines('word\n - word\n - word', { noTrim: true }), [
|
||||
'word', ' - word', ' - word'
|
||||
])
|
||||
})
|
||||
|
||||
runner.test('wrapping text containing ansi escape sequences', function () {
|
||||
a.deepStrictEqual(
|
||||
wordwrap.wrap('Generates something \u001b[3mvery\u001b[0m important.', { width: 35 }),
|
||||
'Generates something \u001b[3mvery\u001b[0m important.'
|
||||
)
|
||||
})
|
||||
|
||||
runner.test('non-string input', function () {
|
||||
a.strictEqual(wordwrap.wrap(undefined), '')
|
||||
a.strictEqual(wordwrap.wrap(function () {}), 'function () {}')
|
||||
a.strictEqual(wordwrap.wrap({}), '[object Object]')
|
||||
a.strictEqual(wordwrap.wrap(null), 'null')
|
||||
a.strictEqual(wordwrap.wrap(true), 'true')
|
||||
a.strictEqual(wordwrap.wrap(0), '0')
|
||||
a.strictEqual(wordwrap.wrap(NaN), 'NaN')
|
||||
a.strictEqual(wordwrap.wrap(Infinity), 'Infinity')
|
||||
})
|
||||
Reference in New Issue
Block a user