Skip to content

Commit 9894315

Browse files
committed
revert default indent
Reverts the default indent to be 2 spaces. This will be published as a patch to 1.2.*
1 parent f64b188 commit 9894315

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

.verb.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ wrap(str, {width: 60});
4141

4242
Type: `String`
4343

44-
Default: `` (none)
44+
Default: ` ` (two spaces)
4545

4646
The string to use at the beginning of each line.
4747

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ wrap(str, {width: 60});
5252

5353
Type: `String`
5454

55-
Default: `` (none)
55+
Default: `` (two spaces)
5656

5757
The string to use at the beginning of each line.
5858

@@ -171,8 +171,8 @@ You might also be interested in these projects:
171171
| --- | --- |
172172
| 47 | [jonschlinkert](https://github.com/jonschlinkert) |
173173
| 7 | [OlafConijn](https://github.com/OlafConijn) |
174+
| 3 | [doowb](https://github.com/doowb) |
174175
| 2 | [aashutoshrathi](https://github.com/aashutoshrathi) |
175-
| 2 | [doowb](https://github.com/doowb) |
176176
| 2 | [lordvlad](https://github.com/lordvlad) |
177177
| 2 | [hildjj](https://github.com/hildjj) |
178178
| 1 | [danilosampaio](https://github.com/danilosampaio) |
@@ -198,4 +198,4 @@ Released under the [MIT License](LICENSE).
198198

199199
***
200200

201-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 18, 2023._
201+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 22, 2023._

index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare namespace wrap {
1616

1717
/**
1818
* The string to use at the beginning of each line.
19-
* @default ´´ (none)
19+
* @default ´ ´ (two spaces)
2020
*/
2121
indent?: string;
2222

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = function(str, options) {
2929
var width = options.width || 50;
3030
var indent = (typeof options.indent === 'string')
3131
? options.indent
32-
: '';
32+
: ' ';
3333

3434
var newline = options.newline || '\n' + indent;
3535
var escape = typeof options.escape === 'function'

test.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,62 @@ var str = 'A project without documentation is like a project that doesn\'t exist
88

99
describe('wrap', function () {
1010
it('should use defaults to wrap words in the given string:', function () {
11-
assert.equal(wrap(str), 'A project without documentation is like a project \nthat doesn\'t exist. Verb solves this by making it \ndead simple to generate project documentation, \nusing simple markdown templates, with zero \nconfiguration required. ');
11+
assert.equal(wrap(str), ' A project without documentation is like a project \n that doesn\'t exist. Verb solves this by making it \n dead simple to generate project documentation, \n using simple markdown templates, with zero \n configuration required. ');
1212
});
1313

1414
it('should wrap to the specified width:', function () {
15-
assert.equal(wrap(str, {width: 40}), 'A project without documentation is like \na project that doesn\'t exist. Verb \nsolves this by making it dead simple to \ngenerate project documentation, using \nsimple markdown templates, with zero \nconfiguration required. ');
15+
assert.equal(wrap(str, {width: 40}), ' A project without documentation is like \n a project that doesn\'t exist. Verb \n solves this by making it dead simple to \n generate project documentation, using \n simple markdown templates, with zero \n configuration required. ');
1616
});
1717

1818
it('should indent the specified amount:', function () {
1919
assert.equal(wrap(str, {indent: ' '}), ' A project without documentation is like a project \n that doesn\'t exist. Verb solves this by making it \n dead simple to generate project documentation, \n using simple markdown templates, with zero \n configuration required. ');
2020
});
2121

2222
it('should use the given string for newlines:', function () {
23-
assert.equal(wrap(str, {newline: '\n\n-'}), 'A project without documentation is like a project \n\n-that doesn\'t exist. Verb solves this by making it \n\n-dead simple to generate project documentation, \n\n-using simple markdown templates, with zero \n\n-configuration required. ');
23+
assert.equal(wrap(str, {newline: '\n\n-'}), ' A project without documentation is like a project \n\n-that doesn\'t exist. Verb solves this by making it \n\n-dead simple to generate project documentation, \n\n-using simple markdown templates, with zero \n\n-configuration required. ');
2424
});
2525

2626
it('should run the escape function on each line', function () {
2727
assert.equal(
2828
wrap(str, {escape: function(e) {return e.replace('\'', '\\\'')}}),
29-
'A project without documentation is like a project \nthat doesn\\\'t exist. Verb solves this by making it \ndead simple to generate project documentation, \nusing simple markdown templates, with zero \nconfiguration required. '
29+
' A project without documentation is like a project \n that doesn\\\'t exist. Verb solves this by making it \n dead simple to generate project documentation, \n using simple markdown templates, with zero \n configuration required. '
3030
)
3131
});
3232

3333
it('should trim trailing whitespace:', function () {
34-
assert.equal(wrap(str, {trim: true}), 'A project without documentation is like a project\nthat doesn\'t exist. Verb solves this by making it\ndead simple to generate project documentation,\nusing simple markdown templates, with zero\nconfiguration required.');
34+
assert.equal(wrap(str, {trim: true}), ' A project without documentation is like a project\n that doesn\'t exist. Verb solves this by making it\n dead simple to generate project documentation,\n using simple markdown templates, with zero\n configuration required.');
3535
});
3636

3737
it('should trim trailing whitespace (even for empty lines):', function () {
38-
assert.equal(wrap("a \n\nb \n \nc\t", {trim: true}), 'a\n\nb\n\nc');
38+
assert.equal(wrap("a \n\nb \n \nc\t", {trim: true}), ' a\n\n b\n\n c');
3939
});
4040

4141
it('should handle strings with just newlines', function () {
4242
assert.equal(wrap('\r\n', {indent: '\r\n', width: 18}), '\r\n');
4343
});
4444

4545
it('should handle newlines that occur at the same position as `options.width`', function () {
46-
assert.equal(wrap('asdfg\nqwert', {width:5}), 'asdfg\nqwert');
47-
assert.equal(wrap('aaaaaa\nbbbbbb\ncccccc', {width:6}), 'aaaaaa\nbbbbbb\ncccccc');
46+
assert.equal(wrap('asdfg\nqwert', {width:5}), ' asdfg\n qwert');
47+
assert.equal(wrap('aaaaaa\nbbbbbb\ncccccc', {width:6}), ' aaaaaa\n bbbbbb\n cccccc');
4848
});
4949

5050
it('should handle strings that break where there are multiple spaces', function() {
51-
assert.equal(wrap('foo foo. bar', {width:8}), 'foo foo. \nbar');
52-
assert.equal(wrap('foo foo. bar', {width:8, trim: true}), 'foo foo.\nbar');
51+
assert.equal(wrap('foo foo. bar', {width:8}), ' foo foo. \n bar');
52+
assert.equal(wrap('foo foo. bar', {width:8, trim: true}), ' foo foo.\n bar');
5353
});
5454

5555
it('should cut one long word', function() {
56-
assert.equal(wrap('Supercalifragilisticexpialidocious', {width:24, cut:true}), 'Supercalifragilisticexpi\nalidocious');
56+
assert.equal(wrap('Supercalifragilisticexpialidocious', {width:24, cut:true}), ' Supercalifragilisticexpi\n alidocious');
5757
});
5858

5959
it('should cut long words', function() {
60-
assert.equal(wrap('Supercalifragilisticexpialidocious and Supercalifragilisticexpialidocious', {width:24, cut:true}), 'Supercalifragilisticexpi\nalidocious and Supercali\nfragilisticexpialidociou\ns');
60+
assert.equal(wrap('Supercalifragilisticexpialidocious and Supercalifragilisticexpialidocious', {width:24, cut:true}), ' Supercalifragilisticexpi\n alidocious and Supercali\n fragilisticexpialidociou\n s');
6161
});
6262

6363
it('should wrap on zero space characters', function () {
6464
assert.equal(
6565
wrap('Supercalifragilistic\u200Bexpialidocious', {width: 24}),
66-
'Supercalifragilistic\u200B\nexpialidocious'
66+
' Supercalifragilistic\u200B\n expialidocious'
6767
);
6868
});
6969
});

0 commit comments

Comments
 (0)