Skip to content

Commit

Permalink
docs: add aliases as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Mar 4, 2024
1 parent 0274255 commit 76560ec
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/1.guide/1.index.md
Expand Up @@ -40,6 +40,12 @@ Checks if storage contains a key. Resolves to either `true` or `false`.
await storage.hasItem("foo:bar");
```

You can also use the `has` alias:

```js
await storage.has("foo:bar");
```

### `getItem(key, opts?)`

Gets the value of a key in storage. Resolves to either a javascript primitive value or `undefined`.
Expand All @@ -48,6 +54,12 @@ Gets the value of a key in storage. Resolves to either a javascript primitive va
await storage.getItem("foo:bar");
```

You can also use the `get` alias:

```js
await storage.get("foo:bar");
```

### `getItems(items, opts)`

(Experimental) Gets the value of a multiple keys in storage in parallel.
Expand Down Expand Up @@ -79,6 +91,12 @@ If value is `undefined`, it is same as calling `removeItem(key)`.
await storage.setItem("foo:bar", "baz");
```

You can also use the `set` alias:

```js
await storage.set("foo:bar", "baz");
```

### `setItems(items, opts)`

(Experimental) Add/Update items in parallel to the storage.
Expand Down Expand Up @@ -108,6 +126,12 @@ await storage.removeItem("foo:bar", { removeMeta: true });
// same as await storage.removeItem("foo:bar", true);
```

You can also use the `del` alias:

```js
await storage.del("foo:bar");
```

### `getMeta(key, opts = { nativeOnly? })`

Get metadata object for a specific key.
Expand Down Expand Up @@ -151,6 +175,12 @@ If a base is provided, only keys starting with the base will be returned also on
await storage.getKeys();
```

You can also use the `keys` alias:

```js
await storage.keys();
```

### `clear(base?, opts?)`

Removes all stored key/values. If a base is provided, only mounts matching base will be cleared.
Expand Down

0 comments on commit 76560ec

Please sign in to comment.