1
0
Fork 0

fix(dev): One-liner admonitions

This commit is contained in:
Joost De Cock 2024-09-29 07:14:59 +02:00
parent a6d656c19e
commit da41cc0fc9
60 changed files with 860 additions and 659 deletions

View file

@ -13,7 +13,9 @@ rather through a plugin.
Store Store.extend(Array methods=[])
```
:::tipThis method is chainable as it returns the `Store` object:::
:::tip
This method is chainable as it returns the `Store` object
:::
The single argument should be an Array of methods to add to the
store. Each entry in the array should be an array itself holding a path in
@ -23,13 +25,11 @@ The expected first parameter for the method is the `Store` instance.
```js
function myCustomMethod(store, ...otherArguments) {
// Do something clever
// Do something clever
}
const store = new Store([
["path.to.the.method", myCustomMethod ]
])
```
const store = new Store([['path.to.the.method', myCustomMethod]])
```
With the configuration above, you can call `store.path.to.the.method()` and it
will run `myCustomMethod()`.
@ -46,5 +46,3 @@ The Store will not allow you to extend any of the following keys:
- `unset`
- `get`
- `extend`

View file

@ -12,18 +12,18 @@ If `key` does not hold and Array, the Store will log a warning, but nothing will
Store store.push(mixed value1, mixed value2, ...)
```
:::noteThis method is [variadic](https://en.wikipedia.org/wiki/Variadic_function):::
:::note
This method is [variadic](https://en.wikipedia.org/wiki/Variadic_function)
:::
:::tipThis method is chainable as it returns the `Store` object:::
:::tip
This method is chainable as it returns the `Store` object
:::
## Example
```js
const store = new Store()
store.set('example', ['Hi there'])
store.push(
'How are you doing',
'How are YOU doing'
)
store.push('How are you doing', 'How are YOU doing')
```

View file

@ -11,7 +11,9 @@ The `Store.set()` method stores the value of `value` in the store under key
Store store.set(mixed key, mixed value)
```
:::tipThis method is chainable as it returns the `Store` object:::
:::tip
This method is chainable as it returns the `Store` object
:::
## Example
@ -42,4 +44,3 @@ value = store.get(['my', 'other', 'nested', 'example']) // works
value = store.my.nested.example // Also works
value = store.my.other.nested.example // Also works
```

View file

@ -11,7 +11,9 @@ The `Store.set()` method stores the value of `value` in the store under key
Store store.set(mixed key, mixed value)
```
:::tipThis method is chainable as it returns the `Store` object:::
:::tip
This method is chainable as it returns the `Store` object
:::
## Example
@ -20,4 +22,3 @@ const store = new Store()
store.set('example', 'Hi there')
store.setIfUnset('example', 'Hi again') // This has no effect
```

View file

@ -10,12 +10,12 @@ The `Store.unset()` value removes a `key` from the store.
Store store.unset(string key)
```
:::tipThis method is chainable as it returns the `Store` object:::
:::tip
This method is chainable as it returns the `Store` object
:::
## Example
```js
const store = new Store()
.set('example', 'I will be gone before you know it')
.unset('example')
const store = new Store().set('example', 'I will be gone before you know it').unset('example')
```