Skip to content

Commit

Permalink
Updated docs to include example of nested formatting (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
CEbbinghaus committed Oct 9, 2022
1 parent e7baaf0 commit 38b0d83
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- "master"
paths:
- 'docs/**'
- docs

jobs:
deploy:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/premerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches:
- "master"
paths-ignore:
- docs
- .vscode

jobs:
setup:
Expand Down
12 changes: 7 additions & 5 deletions docs/src/pages/splat.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ layout: ../layouts/MainLayout.astro

Is a method of [String Formatting](https://en.wikipedia.org/wiki/String_interpolation) Implemented in Lipe that uses property names for Keys. The formatter uses the keys out of the string to evaluate the values to be substituted.

**Note**
While currently only member names are supported There is planned functionality for Submember access: e.g `{Member.Submember}`

The Basic Syntax goes as follows:

```javascript
logger.Log("Hello {greet}!", {greet: "World!"});
logger.Log("Hello {greet}!", {greet: "World!"}); // returns "Hello World!"
```

the `{greet}` then gets replaced with the corresponding object found in the argument object.
the `{greet}` then gets replaced with the corresponding object found in the argument object.

This also works for nested objects e.g `obj.value`
```javascript
logger.Log("Nested Value: {obj.value}", {obj: {value: 42}}); // returns "Nested Value: 42"
```

0 comments on commit 38b0d83

Please sign in to comment.