Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Respin] remove default indent #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .verb.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod te
Results in:

```
Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
```


Expand Down Expand Up @@ -41,7 +41,7 @@ wrap(str, {width: 60});

Type: `String`

Default: ` ` (two spaces)
Default: `` (none)

The string to use at the beginning of each line.

Expand Down Expand Up @@ -112,3 +112,17 @@ Break a word between any two letters when the word is longer than the specified
```js
wrap(str, {cut: true});
```

## Troubleshooting

### options.indent

From 1.x to 2.x the default indent has changed from two literal spaces, to none.

If you wish to preserve the old behaviour; you will want to explicitly set this to two spaces.

**Example:**

```js
wrap(str, {indent: ' '});
```
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod te
Results in:

```
Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
```

## Options
Expand All @@ -52,7 +52,7 @@ wrap(str, {width: 60});

Type: `String`

Default: `` (two spaces)
Default: `` (none)

The string to use at the beginning of each line.

Expand Down Expand Up @@ -123,6 +123,20 @@ Break a word between any two letters when the word is longer than the specified
wrap(str, {cut: true});
```

## Troubleshooting

### options.indent

From 1.x to 2.x the default indent has changed from two literal spaces, to none.

If you wish to preserve the old behaviour; you will want to explicitly set this to two spaces.

**Example:**

```js
wrap(str, {indent: ' '});
```

## About

<details>
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare namespace wrap {

/**
* The string to use at the beginning of each line.
* @default ´ ´ (two spaces)
* @default ´´ (none)
*/
indent?: string;

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading