Skip to content

Commit 9310731

Browse files
committedJul 17, 2020
Update Dependencies
1 parent c6b88b7 commit 9310731

16 files changed

+3682
-3663
lines changed
 

‎.travis.yml

-5
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,23 @@ branches:
33
only:
44
- master
55
- develop
6-
- /^greenkeeper/.*$/
76
- /^feature/.*$/
87
language: node_js
98
node_js:
109
- stable
1110
- 12
12-
- 11
1311
- 10
1412
env:
1513
global:
1614
- CC_TEST_REPORTER_ID=ba42fc27c58fe141f19793fa5acb42d4d229da491a4c7a1568ba50a69a009e1f
1715
before_install:
1816
- npm i -g npm
19-
- npm install -g greenkeeper-lockfile
2017
install: npm ci --no-optional
2118
before_script:
22-
- greenkeeper-lockfile-update
2319
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
2420
- chmod +x ./cc-test-reporter
2521
- ./cc-test-reporter before-build
2622
after_script:
27-
- greenkeeper-lockfile-upload
2823
- "[ $TRAVIS_NODE_VERSION = stable ] && nyc report --reporter=lcov && ./cc-test-reporter
2924
after-build --debug -t lcov --exit-code $TRAVIS_TEST_RESULT || echo 'Coverage skipped'"
3025
notifications:

‎bin/truwrap

+41-36
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var commonTags = require('common-tags');
1111
var string = require('@thebespokepixel/string');
1212
var trucolor = require('trucolor');
1313
var deepAssign = _interopDefault(require('deep-assign'));
14+
var path = require('path');
1415
var terminalFeatures = _interopDefault(require('term-ng'));
1516
var columnify = _interopDefault(require('columnify'));
1617
var osLocale = _interopDefault(require('os-locale'));
@@ -19,7 +20,6 @@ var meta = _interopDefault(require('@thebespokepixel/meta'));
1920
var nSelector = require('@thebespokepixel/n-selector');
2021
var ansiRegex = _interopDefault(require('ansi-regex'));
2122
var fs = require('fs');
22-
var path = require('path');
2323
var _min = _interopDefault(require('lodash/min'));
2424
var _max = _interopDefault(require('lodash/max'));
2525
var _split = _interopDefault(require('lodash/split'));
@@ -57,42 +57,42 @@ const scripts = {
5757
};
5858
const devDependencies = {
5959
"@ava/babel": "^1.0.1",
60-
"@babel/core": "^7.8.4",
61-
"@babel/preset-env": "^7.8.4",
62-
ava: "^3.3.0",
60+
"@babel/core": "^7.10.5",
61+
"@babel/preset-env": "^7.10.4",
62+
ava: "^3.10.1",
6363
"babel-plugin-lodash": "^3.3.4",
64-
"documentation-theme-bespoke": "^1.1.3",
64+
"documentation-theme-bespoke": "^1.1.6",
6565
gulp: "^4.0.2",
6666
"gulp-better-rollup": "^4.0.1",
6767
"gulp-chmod": "^3.0.0",
6868
"gulp-rename": "^2.0.0",
69-
nyc: "^15.0.0",
70-
rollup: "^1.31.1",
71-
"rollup-plugin-babel": "^4.3.3",
69+
nyc: "^15.1.0",
70+
rollup: "^2.21.0",
71+
"rollup-plugin-babel": "^4.4.0",
7272
"rollup-plugin-commonjs": "^10.1.0",
7373
"rollup-plugin-json": "^4.0.0",
7474
"rollup-plugin-node-resolve": "^5.2.0",
7575
"semver-regex": "^3.1.1",
76-
xo: "^0.26.1"
76+
xo: "^0.32.1"
7777
};
7878
const dependencies = {
79-
"@thebespokepixel/meta": "^2.0.2",
80-
"@thebespokepixel/n-selector": "^2.0.1",
81-
"@thebespokepixel/string": "^1.0.1",
79+
"@thebespokepixel/meta": "^2.0.4",
80+
"@thebespokepixel/n-selector": "^2.0.2",
81+
"@thebespokepixel/string": "^1.0.3",
8282
"ansi-regex": "^5.0.0",
8383
columnify: "^1.5.4",
8484
"common-tags": "^1.8.0",
8585
"deep-assign": "^3.0.0",
86-
"es6-promisify": "^6.0.2",
87-
"get-stdin": "^7.0.0",
88-
lodash: "^4.17.15",
89-
"os-locale": "^4.0.0",
86+
"es6-promisify": "^6.1.1",
87+
"get-stdin": "^8.0.0",
88+
lodash: "^4.17.19",
89+
"os-locale": "^5.0.0",
9090
"read-pkg-up": "^7.0.1",
91-
"term-ng": "^2.0.1",
92-
trucolor: "^2.0.1",
91+
"term-ng": "^2.0.2",
92+
trucolor: "^2.0.2",
9393
"update-notifier": "^4.1.0",
94-
verbosity: "^2.0.1",
95-
yargs: "^15.1.0"
94+
verbosity: "^2.0.2",
95+
yargs: "^15.4.1"
9696
};
9797
const engines = {
9898
node: ">=10.0"
@@ -157,10 +157,7 @@ const badges = {
157157
],
158158
"Development Status": [
159159
[
160-
"greenkeeper",
161-
"travis-com-dev"
162-
],
163-
[
160+
"travis-com-dev",
164161
"david-dev",
165162
"david-devdeps-dev"
166163
],
@@ -232,7 +229,7 @@ class Tokeniser {
232229
this.tokenisingRegex = tokenisingRegex || function () {
233230
switch (renderMode.selected) {
234231
case 'keep':
235-
return /^.*$/mg;
232+
return /^.*$/gm;
236233

237234
default:
238235
return /\S+\s+/g;
@@ -250,7 +247,9 @@ class Tokeniser {
250247

251248
}
252249

253-
var createTokeniser = (tokenisingRegex => new Tokeniser(tokenisingRegex));
250+
function createTokeniser(tokenisingRegex) {
251+
return new Tokeniser(tokenisingRegex);
252+
}
254253

255254
const newlineRegex$1 = /^>\/\\\/\/__<$/;
256255
const tabRegex$1 = /^>T\/\\B<$/;
@@ -333,7 +332,9 @@ class LineFitter {
333332

334333
}
335334

336-
var createLineFitter = ((margin, width, tabWidth) => new LineFitter([margin, width, tabWidth]));
335+
function createLineFitter(margin, width, tabWidth) {
336+
return new LineFitter([margin, width, tabWidth]);
337+
}
337338

338339
class WrapTool {
339340
constructor({
@@ -369,16 +370,18 @@ class WrapTool {
369370
}
370371

371372
this.lines.push(currentLine.toString());
372-
return this.lines.map(this.tokeniser.restore).join('\n');
373+
return this.lines.map(line => this.tokeniser.restore(line)).join('\n');
373374
}
374375

375376
}
376377

377-
var createWrapTool = (options => new WrapTool(options));
378+
function createWrapTool(options) {
379+
return new WrapTool(options);
380+
}
378381

379382
const prefix = '\u001B]1337;File=inline=1;';
380383
const suffix = '\u0007';
381-
const broken = `${__dirname}/../media/broken.png`;
384+
const broken = path.join(__dirname, '/../media/broken.png');
382385

383386
class Image {
384387
constructor({
@@ -427,9 +430,11 @@ class Image {
427430

428431
}
429432

430-
var createImage = (source => new Image(source));
433+
function createImage(source) {
434+
return new Image(source);
435+
}
431436

432-
function parsePanel (buffer_, delimiter_, width_) {
437+
function panel(buffer_, delimiter_, width_) {
433438
let longIdx = 0;
434439
let maxCols = 0;
435440
const spacerCols = [];
@@ -616,7 +621,7 @@ const images = function () {
616621
space: '\t',
617622
cc: createImage({
618623
name: 'logo',
619-
file: `${__dirname}/../media/CCLogo.png`,
624+
file: path.join(__dirname, '/../media/CCLogo.png'),
620625
height: 3
621626
})
622627
};
@@ -841,12 +846,12 @@ if (argv.stamp) {
841846

842847
getStdin().then(input => {
843848
if (argv.panel) {
844-
const panel = parsePanel(input, argv.delimiter, renderer.getWidth());
845-
renderer.panel(panel.content, {
849+
const panel$1 = panel(input, argv.delimiter, renderer.getWidth());
850+
renderer.panel(panel$1.content, {
846851
maxLineWidth: renderer.getWidth(),
847852
showHeaders: false,
848853
truncate: argv.truncate,
849-
config: panel.configuration
854+
config: panel$1.configuration
850855
});
851856
} else {
852857
renderer.write(input);

‎docs/assets/js/site.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/assets/js/split.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/index.html

+8-8
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ <h3 class='left m0 panel-title' id='truwrap'>
220220
</h3>
221221

222222

223-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L50-L218'>
223+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L50-L218'>
224224
<span>src/index.js</span>
225225
</a>
226226

@@ -383,7 +383,7 @@ <h3 class='left m0 panel-title' id='api'>
383383
</h3>
384384

385385

386-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L100-L167'>
386+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L100-L167'>
387387
<span>src/index.js</span>
388388
</a>
389389

@@ -432,7 +432,7 @@ <h3 class='left m0 panel-title' id='api'>
432432
<div class='clearfix'>
433433

434434

435-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L107-L113'>
435+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L107-L113'>
436436
<span>src/index.js</span>
437437
</a>
438438

@@ -495,7 +495,7 @@ <h3 class='left m0 panel-title' id='api'>
495495
<div class='clearfix'>
496496

497497

498-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L119-L119'>
498+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L119-L119'>
499499
<span>src/index.js</span>
500500
</a>
501501

@@ -558,7 +558,7 @@ <h3 class='left m0 panel-title' id='api'>
558558
<div class='clearfix'>
559559

560560

561-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L128-L134'>
561+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L128-L134'>
562562
<span>src/index.js</span>
563563
</a>
564564

@@ -644,7 +644,7 @@ <h3 class='left m0 panel-title' id='api'>
644644
<div class='clearfix'>
645645

646646

647-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L142-L145'>
647+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L142-L145'>
648648
<span>src/index.js</span>
649649
</a>
650650

@@ -722,7 +722,7 @@ <h3 class='left m0 panel-title' id='api'>
722722
<div class='clearfix'>
723723

724724

725-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L152-L155'>
725+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L152-L155'>
726726
<span>src/index.js</span>
727727
</a>
728728

@@ -785,7 +785,7 @@ <h3 class='left m0 panel-title' id='api'>
785785
<div class='clearfix'>
786786

787787

788-
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/83e49ed63446ee129e4118f19d58f849e76870ca/src/index.js#L163-L166'>
788+
<a class='pl3 pr1 right rounded github' href='https://github.com/thebespokepixel/truwrap/blob/c6b88b7540a9dfb28926cea12e733364d98ed92c/src/index.js#L163-L166'>
789789
<span>src/index.js</span>
790790
</a>
791791

‎index.js

+17-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Tokeniser {
2828
this.tokenisingRegex = tokenisingRegex || function () {
2929
switch (renderMode.selected) {
3030
case 'keep':
31-
return /^.*$/mg;
31+
return /^.*$/gm;
3232

3333
default:
3434
return /\S+\s+/g;
@@ -46,7 +46,9 @@ class Tokeniser {
4646

4747
}
4848

49-
var createTokeniser = (tokenisingRegex => new Tokeniser(tokenisingRegex));
49+
function createTokeniser(tokenisingRegex) {
50+
return new Tokeniser(tokenisingRegex);
51+
}
5052

5153
const newlineRegex$1 = /^>\/\\\/\/__<$/;
5254
const tabRegex$1 = /^>T\/\\B<$/;
@@ -129,7 +131,9 @@ class LineFitter {
129131

130132
}
131133

132-
var createLineFitter = ((margin, width, tabWidth) => new LineFitter([margin, width, tabWidth]));
134+
function createLineFitter(margin, width, tabWidth) {
135+
return new LineFitter([margin, width, tabWidth]);
136+
}
133137

134138
class WrapTool {
135139
constructor({
@@ -165,12 +169,14 @@ class WrapTool {
165169
}
166170

167171
this.lines.push(currentLine.toString());
168-
return this.lines.map(this.tokeniser.restore).join('\n');
172+
return this.lines.map(line => this.tokeniser.restore(line)).join('\n');
169173
}
170174

171175
}
172176

173-
var createWrapTool = (options => new WrapTool(options));
177+
function createWrapTool(options) {
178+
return new WrapTool(options);
179+
}
174180

175181
const clr = deepAssign(trucolor.simple({
176182
format: 'sgr'
@@ -184,7 +190,7 @@ const colorReplacer = new commonTags.TemplateTag(commonTags.replaceSubstitutionT
184190

185191
const prefix = '\u001B]1337;File=inline=1;';
186192
const suffix = '\u0007';
187-
const broken = `${__dirname}/../media/broken.png`;
193+
const broken = path.join(__dirname, '/../media/broken.png');
188194

189195
class Image {
190196
constructor({
@@ -233,9 +239,11 @@ class Image {
233239

234240
}
235241

236-
var image = (source => new Image(source));
242+
function createImage(source) {
243+
return new Image(source);
244+
}
237245

238-
function panel (buffer_, delimiter_, width_) {
246+
function panel(buffer_, delimiter_, width_) {
239247
let longIdx = 0;
240248
let maxCols = 0;
241249
const spacerCols = [];
@@ -417,7 +425,7 @@ function truwrap({
417425
}
418426

419427
exports.console = console;
420-
exports.createImage = image;
428+
exports.createImage = createImage;
421429
exports.locale = locale;
422430
exports.metadata = metadata;
423431
exports.parsePanel = panel;

‎index.mjs

+18-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ansiRegex from 'ansi-regex';
88
import { simple, palette } from 'trucolor';
99
import deepAssign from 'deep-assign';
1010
import { statSync, readFileSync } from 'fs';
11-
import { extname, basename } from 'path';
11+
import { join, extname, basename } from 'path';
1212
import _min from 'lodash/min';
1313
import _max from 'lodash/max';
1414
import _split from 'lodash/split';
@@ -22,7 +22,7 @@ class Tokeniser {
2222
this.tokenisingRegex = tokenisingRegex || function () {
2323
switch (renderMode.selected) {
2424
case 'keep':
25-
return /^.*$/mg;
25+
return /^.*$/gm;
2626

2727
default:
2828
return /\S+\s+/g;
@@ -40,7 +40,9 @@ class Tokeniser {
4040

4141
}
4242

43-
var createTokeniser = (tokenisingRegex => new Tokeniser(tokenisingRegex));
43+
function createTokeniser(tokenisingRegex) {
44+
return new Tokeniser(tokenisingRegex);
45+
}
4446

4547
const newlineRegex$1 = /^>\/\\\/\/__<$/;
4648
const tabRegex$1 = /^>T\/\\B<$/;
@@ -123,7 +125,9 @@ class LineFitter {
123125

124126
}
125127

126-
var createLineFitter = ((margin, width, tabWidth) => new LineFitter([margin, width, tabWidth]));
128+
function createLineFitter(margin, width, tabWidth) {
129+
return new LineFitter([margin, width, tabWidth]);
130+
}
127131

128132
class WrapTool {
129133
constructor({
@@ -159,12 +163,14 @@ class WrapTool {
159163
}
160164

161165
this.lines.push(currentLine.toString());
162-
return this.lines.map(this.tokeniser.restore).join('\n');
166+
return this.lines.map(line => this.tokeniser.restore(line)).join('\n');
163167
}
164168

165169
}
166170

167-
var createWrapTool = (options => new WrapTool(options));
171+
function createWrapTool(options) {
172+
return new WrapTool(options);
173+
}
168174

169175
const clr = deepAssign(simple({
170176
format: 'sgr'
@@ -178,7 +184,7 @@ const colorReplacer = new TemplateTag(replaceSubstitutionTransformer(/([a-zA-Z]+
178184

179185
const prefix = '\u001B]1337;File=inline=1;';
180186
const suffix = '\u0007';
181-
const broken = `${__dirname}/../media/broken.png`;
187+
const broken = join(__dirname, '/../media/broken.png');
182188

183189
class Image {
184190
constructor({
@@ -227,9 +233,11 @@ class Image {
227233

228234
}
229235

230-
var image = (source => new Image(source));
236+
function createImage(source) {
237+
return new Image(source);
238+
}
231239

232-
function panel (buffer_, delimiter_, width_) {
240+
function panel(buffer_, delimiter_, width_) {
233241
let longIdx = 0;
234242
let maxCols = 0;
235243
const spacerCols = [];
@@ -410,4 +418,4 @@ function truwrap({
410418
}
411419
}
412420

413-
export { console, image as createImage, locale, metadata, panel as parsePanel, renderMode, truwrap };
421+
export { console, createImage, locale, metadata, panel as parsePanel, renderMode, truwrap };

‎package-lock.json

+3,541-3,541
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+20-23
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,42 @@
3131
},
3232
"devDependencies": {
3333
"@ava/babel": "^1.0.1",
34-
"@babel/core": "^7.8.4",
35-
"@babel/preset-env": "^7.8.4",
36-
"ava": "^3.3.0",
34+
"@babel/core": "^7.10.5",
35+
"@babel/preset-env": "^7.10.4",
36+
"ava": "^3.10.1",
3737
"babel-plugin-lodash": "^3.3.4",
38-
"documentation-theme-bespoke": "^1.1.3",
38+
"documentation-theme-bespoke": "^1.1.6",
3939
"gulp": "^4.0.2",
4040
"gulp-better-rollup": "^4.0.1",
4141
"gulp-chmod": "^3.0.0",
4242
"gulp-rename": "^2.0.0",
43-
"nyc": "^15.0.0",
44-
"rollup": "^1.31.1",
45-
"rollup-plugin-babel": "^4.3.3",
43+
"nyc": "^15.1.0",
44+
"rollup": "^2.21.0",
45+
"rollup-plugin-babel": "^4.4.0",
4646
"rollup-plugin-commonjs": "^10.1.0",
4747
"rollup-plugin-json": "^4.0.0",
4848
"rollup-plugin-node-resolve": "^5.2.0",
4949
"semver-regex": "^3.1.1",
50-
"xo": "^0.26.1"
50+
"xo": "^0.32.1"
5151
},
5252
"dependencies": {
53-
"@thebespokepixel/meta": "^2.0.2",
54-
"@thebespokepixel/n-selector": "^2.0.1",
55-
"@thebespokepixel/string": "^1.0.1",
53+
"@thebespokepixel/meta": "^2.0.4",
54+
"@thebespokepixel/n-selector": "^2.0.2",
55+
"@thebespokepixel/string": "^1.0.3",
5656
"ansi-regex": "^5.0.0",
5757
"columnify": "^1.5.4",
5858
"common-tags": "^1.8.0",
5959
"deep-assign": "^3.0.0",
60-
"es6-promisify": "^6.0.2",
61-
"get-stdin": "^7.0.0",
62-
"lodash": "^4.17.15",
63-
"os-locale": "^4.0.0",
60+
"es6-promisify": "^6.1.1",
61+
"get-stdin": "^8.0.0",
62+
"lodash": "^4.17.19",
63+
"os-locale": "^5.0.0",
6464
"read-pkg-up": "^7.0.1",
65-
"term-ng": "^2.0.1",
66-
"trucolor": "^2.0.1",
65+
"term-ng": "^2.0.2",
66+
"trucolor": "^2.0.2",
6767
"update-notifier": "^4.1.0",
68-
"verbosity": "^2.0.1",
69-
"yargs": "^15.1.0"
68+
"verbosity": "^2.0.2",
69+
"yargs": "^15.4.1"
7070
},
7171
"engines": {
7272
"node": ">=10.0"
@@ -131,10 +131,7 @@
131131
],
132132
"Development Status": [
133133
[
134-
"greenkeeper",
135-
"travis-com-dev"
136-
],
137-
[
134+
"travis-com-dev",
138135
"david-dev",
139136
"david-devdeps-dev"
140137
],

‎readme.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
##### Development Status
1111

12-
[![Greenkeeper](https://badges.greenkeeper.io/thebespokepixel/truwrap.svg)](https://greenkeeper.io/ "Greenkeeper") [![Travis](https://img.shields.io/travis/com/thebespokepixel/truwrap/develop?logo=travis)](https://travis-ci.com/thebespokepixel/truwrap "Travis")
13-
[![David](https://david-dm.org/thebespokepixel/truwrap/develop/status.svg)](https://david-dm.org/thebespokepixel/truwrap/develop "David") [![David-developer](https://david-dm.org/thebespokepixel/truwrap/develop/dev-status.svg)](https://david-dm.org/thebespokepixel/truwrap/develop?type=dev "David-developer")
12+
[![Travis](https://img.shields.io/travis/com/thebespokepixel/truwrap/develop?logo=travis)](https://travis-ci.com/thebespokepixel/truwrap "Travis") [![David](https://david-dm.org/thebespokepixel/truwrap/develop/status.svg)](https://david-dm.org/thebespokepixel/truwrap/develop "David") [![David-developer](https://david-dm.org/thebespokepixel/truwrap/develop/dev-status.svg)](https://david-dm.org/thebespokepixel/truwrap/develop?type=dev "David-developer")
1413
[![Snyk](https://snyk.io/test/github/thebespokepixel/truwrap/badge.svg)](https://snyk.io/test/github/thebespokepixel/truwrap "Snyk") [![Code-climate](https://api.codeclimate.com/v1/badges/5732d1aad01d74b6ef4a/maintainability)](https://codeclimate.com/github/thebespokepixel/truwrap/maintainability "Code-climate") [![Coverage](https://api.codeclimate.com/v1/badges/5732d1aad01d74b6ef4a/test_coverage)](https://codeclimate.com/github/thebespokepixel/truwrap/test_coverage "Coverage")
1514

1615
##### Documentation/Help

‎src/cli/help.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
╰─────────────┴──────────────────────────────────────────────────────────────── */
44

55
/** @module module:truwrap/cli/help */
6-
6+
import {join} from 'path'
77
import terminalFeatures from 'term-ng'
88
import {stripIndent} from 'common-tags'
99

@@ -16,7 +16,7 @@ const images = (function () {
1616
space: '\t',
1717
cc: createImage({
1818
name: 'logo',
19-
file: `${__dirname}/../media/CCLogo.png`,
19+
file: join(__dirname, '/../media/CCLogo.png'),
2020
height: 3
2121
})
2222
}

‎src/lib/classes/image.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
╰────────────────────┴──────────────────────────────────────────────────────── */
44

55
import {readFileSync, statSync} from 'fs'
6-
import {basename, extname} from 'path'
6+
import {basename, extname, join} from 'path'
77
import {console} from '../..'
88

99
const prefix = '\u001B]1337;File=inline=1;'
1010
const suffix = '\u0007'
1111

12-
const broken = `${__dirname}/../media/broken.png`
12+
const broken = join(__dirname, '/../media/broken.png')
1313

1414
/**
1515
* Provides an image formatted for inclusion in the TTY
@@ -84,9 +84,11 @@ class Image {
8484
}
8585

8686
/**
87-
* Create a new Image
87+
* Creates an image.
8888
* @private
89-
* @param {Object} source - Image options
90-
* @return {Image} A configured (but not yet loaded) image.
89+
* @param {String} source The source
90+
* @return {Image} A configured (but not yet loaded) image.
9191
*/
92-
export default source => new Image(source)
92+
export default function createImage(source) {
93+
return new Image(source)
94+
}

‎src/lib/classes/line-fitter.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,13 @@ class LineFitter {
113113
}
114114

115115
/**
116-
* Create a new line of wrapped text.
116+
* Creates a line fitter - a new line of wrapped text..
117117
* @private
118-
* @param {String} margin - The left margin, made up of spaces
119-
* @param {Number} width - The width the line can take up
120-
* @param {Number} tabWidth - Desired TAB width
121-
* @return {LineFitter} The LineFitter instance.
118+
* @param {String} margin The left margin, made up of spaces
119+
* @param {Number} width The width the line can take up
120+
* @param {Number} tabWidth Desired TAB width
121+
* @return {LineFitter} The line fitter.
122122
*/
123-
export default (margin, width, tabWidth) =>
124-
new LineFitter([margin, width, tabWidth])
123+
export default function createLineFitter(margin, width, tabWidth) {
124+
return new LineFitter([margin, width, tabWidth])
125+
}

‎src/lib/classes/panel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import _ from 'lodash'
1212
* @param {Number} width_ Panel width.
1313
* @return {object} The columnify configuration.
1414
*/
15-
export default function (buffer_, delimiter_, width_) {
15+
export default function panel(buffer_, delimiter_, width_) {
1616
let longIdx = 0
1717
let maxCols = 0
1818
const spacerCols = []

‎src/lib/classes/tokeniser.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Tokeniser {
2222
this.tokenisingRegex = tokenisingRegex || (function () {
2323
switch (renderMode.selected) {
2424
case 'keep':
25-
return /^.*$/mg
25+
return /^.*$/gm
2626
default:
2727
return /\S+\s+/g
2828
}
@@ -57,10 +57,12 @@ class Tokeniser {
5757
}
5858

5959
/**
60-
* Create a new Tokeniser instance
60+
* Creates a tokeniser.
6161
* @private
62-
* @param {Regexp} tokenisingRegex - The regex that forms the word boundaries.
62+
* @param {<type>} tokenisingRegex The tokenising regular expression
6363
* @see {@link Tokeniser}
64-
* @return {Tokeniser} A tokeniser instance.
64+
* @return {Tokeniser} { A tokeniser instance. }
6565
*/
66-
export default tokenisingRegex => new Tokeniser(tokenisingRegex)
66+
export default function createTokeniser(tokenisingRegex) {
67+
return new Tokeniser(tokenisingRegex)
68+
}

‎src/lib/classes/wrap-tool.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,16 @@ class WrapTool {
5555
}
5656

5757
this.lines.push(currentLine.toString())
58-
return this.lines.map(this.tokeniser.restore).join('\n')
58+
return this.lines.map(line => this.tokeniser.restore(line)).join('\n')
5959
}
6060
}
6161

6262
/**
63-
* Create a WrapTool instance
64-
* @param {options} options - Provided options
63+
* Creates a wrap tool.
6564
* @private
66-
* @return {WrapTool} A configured tool.
65+
* @param {Object} options The options
66+
* @return {WrapTool} The wrap tool.
6767
*/
68-
export default options => new WrapTool(options)
68+
export default function createWrapTool(options) {
69+
return new WrapTool(options)
70+
}

0 commit comments

Comments
 (0)
Please sign in to comment.