From 98943154855b0dd79b707462b9202614990c7f61 Mon Sep 17 00:00:00 2001 From: Brian Woodward Date: Sat, 22 Jul 2023 10:33:56 -0400 Subject: [PATCH] revert default indent Reverts the default indent to be 2 spaces. This will be published as a patch to 1.2.* --- .verb.md | 2 +- README.md | 6 +++--- index.d.ts | 2 +- index.js | 2 +- test.js | 26 +++++++++++++------------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.verb.md b/.verb.md index 8163c38..270b02c 100644 --- a/.verb.md +++ b/.verb.md @@ -41,7 +41,7 @@ wrap(str, {width: 60}); Type: `String` -Default: `` (none) +Default: ` ` (two spaces) The string to use at the beginning of each line. diff --git a/README.md b/README.md index 804c750..3305953 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ wrap(str, {width: 60}); Type: `String` -Default: `` (none) +Default: `` (two spaces) The string to use at the beginning of each line. @@ -171,8 +171,8 @@ You might also be interested in these projects: | --- | --- | | 47 | [jonschlinkert](https://github.com/jonschlinkert) | | 7 | [OlafConijn](https://github.com/OlafConijn) | +| 3 | [doowb](https://github.com/doowb) | | 2 | [aashutoshrathi](https://github.com/aashutoshrathi) | -| 2 | [doowb](https://github.com/doowb) | | 2 | [lordvlad](https://github.com/lordvlad) | | 2 | [hildjj](https://github.com/hildjj) | | 1 | [danilosampaio](https://github.com/danilosampaio) | @@ -198,4 +198,4 @@ Released under the [MIT License](LICENSE). *** -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 18, 2023._ \ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 22, 2023._ \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 1acd425..07e06f8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -16,7 +16,7 @@ declare namespace wrap { /** * The string to use at the beginning of each line. - * @default ´´ (none) + * @default ´ ´ (two spaces) */ indent?: string; diff --git a/index.js b/index.js index 4e4dcaa..08f1e41 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,7 @@ module.exports = function(str, options) { var width = options.width || 50; var indent = (typeof options.indent === 'string') ? options.indent - : ''; + : ' '; var newline = options.newline || '\n' + indent; var escape = typeof options.escape === 'function' diff --git a/test.js b/test.js index e60fee8..42f0a19 100644 --- a/test.js +++ b/test.js @@ -8,11 +8,11 @@ var str = 'A project without documentation is like a project that doesn\'t exist describe('wrap', function () { it('should use defaults to wrap words in the given string:', function () { - 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. '); + 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. '); }); it('should wrap to the specified width:', function () { - 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. '); + 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. '); }); it('should indent the specified amount:', function () { @@ -20,22 +20,22 @@ describe('wrap', function () { }); it('should use the given string for newlines:', function () { - 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. '); + 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. '); }); it('should run the escape function on each line', function () { assert.equal( wrap(str, {escape: function(e) {return e.replace('\'', '\\\'')}}), - '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. ' + ' 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. ' ) }); it('should trim trailing whitespace:', function () { - 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.'); + 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.'); }); it('should trim trailing whitespace (even for empty lines):', function () { - assert.equal(wrap("a \n\nb \n \nc\t", {trim: true}), 'a\n\nb\n\nc'); + assert.equal(wrap("a \n\nb \n \nc\t", {trim: true}), ' a\n\n b\n\n c'); }); it('should handle strings with just newlines', function () { @@ -43,27 +43,27 @@ describe('wrap', function () { }); it('should handle newlines that occur at the same position as `options.width`', function () { - assert.equal(wrap('asdfg\nqwert', {width:5}), 'asdfg\nqwert'); - assert.equal(wrap('aaaaaa\nbbbbbb\ncccccc', {width:6}), 'aaaaaa\nbbbbbb\ncccccc'); + assert.equal(wrap('asdfg\nqwert', {width:5}), ' asdfg\n qwert'); + assert.equal(wrap('aaaaaa\nbbbbbb\ncccccc', {width:6}), ' aaaaaa\n bbbbbb\n cccccc'); }); it('should handle strings that break where there are multiple spaces', function() { - assert.equal(wrap('foo foo. bar', {width:8}), 'foo foo. \nbar'); - assert.equal(wrap('foo foo. bar', {width:8, trim: true}), 'foo foo.\nbar'); + assert.equal(wrap('foo foo. bar', {width:8}), ' foo foo. \n bar'); + assert.equal(wrap('foo foo. bar', {width:8, trim: true}), ' foo foo.\n bar'); }); it('should cut one long word', function() { - assert.equal(wrap('Supercalifragilisticexpialidocious', {width:24, cut:true}), 'Supercalifragilisticexpi\nalidocious'); + assert.equal(wrap('Supercalifragilisticexpialidocious', {width:24, cut:true}), ' Supercalifragilisticexpi\n alidocious'); }); it('should cut long words', function() { - assert.equal(wrap('Supercalifragilisticexpialidocious and Supercalifragilisticexpialidocious', {width:24, cut:true}), 'Supercalifragilisticexpi\nalidocious and Supercali\nfragilisticexpialidociou\ns'); + assert.equal(wrap('Supercalifragilisticexpialidocious and Supercalifragilisticexpialidocious', {width:24, cut:true}), ' Supercalifragilisticexpi\n alidocious and Supercali\n fragilisticexpialidociou\n s'); }); it('should wrap on zero space characters', function () { assert.equal( wrap('Supercalifragilistic\u200Bexpialidocious', {width: 24}), - 'Supercalifragilistic\u200B\nexpialidocious' + ' Supercalifragilistic\u200B\n expialidocious' ); }); });