From 76560ecb5e054588dd215f0f47d81e66e31b47cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Mon, 4 Mar 2024 10:14:09 +0100 Subject: [PATCH] docs: add aliases as well --- docs/1.guide/1.index.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/1.guide/1.index.md b/docs/1.guide/1.index.md index 37b2409b..cf529bb6 100644 --- a/docs/1.guide/1.index.md +++ b/docs/1.guide/1.index.md @@ -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`. @@ -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. @@ -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. @@ -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. @@ -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.