Skip to content

Commit

Permalink
updating readme to add ignoreDefaultExpansion
Browse files Browse the repository at this point in the history
  • Loading branch information
osamaadam committed Jul 19, 2024
1 parent 46884c9 commit 56c552a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,41 @@ const expanded = explode(
console.log(expanded); // Hello, $USER!, and User X, User Y!
```

#### ignoreDefaultExpansion

If `true`, default expansion in the form of `${var:-default}` or `${var:=default}` will not be expanded.

> Note: This will NOT work with $var:-default or $var:=default.
> For reference: <https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02>
```ts
import { explode } from "explode-env";

const expanded = explode(
"Hello, ${WORLD:=World}! Welcome ${WORLD}!"
{},
{
ignoreDefaultExpansion: false,
}
);

console.log(expanded); // Hello, World! Welcome World!
```

```ts
import { explode } from "explode-env";

const expanded = explode(
"Hello, ${WORLD:=World}! Welcome ${WORLD}!"
{},
{
ignoreDefaultExpansion: true,
}
);

console.log(expanded); // Hello, ! Welcome !
```

## Running tests

```sh
Expand Down

0 comments on commit 56c552a

Please sign in to comment.