@nanostores/query
Advanced tools
Comparing version 0.1.3 to 0.2.0
{ | ||
"name": "@nanostores/query", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Tiny remote data fetching library for Nano Stores", | ||
@@ -44,4 +44,11 @@ "scripts": { | ||
"@evilmartians/lefthook": "^1.2.6", | ||
"@nanostores/react": "^0.7.1", | ||
"@rollup/plugin-strip": "^3.0.2", | ||
"@testing-library/react": "^14.0.0", | ||
"@types/react": "^18.2.7", | ||
"@types/react-dom": "^18.2.4", | ||
"happy-dom": "^9.20.3", | ||
"nanostores": "^0.7.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"typescript": "^4.9.4", | ||
@@ -48,0 +55,0 @@ "vite": "^3.0.4", |
@@ -51,3 +51,3 @@ # Nano Stores Query | ||
export const [createFetcherStore, createMutatorStore] = nanoquery({ | ||
fetcher: (...keys: string[]) => fetch(keys.join('')).then((r) => r.json()), | ||
fetcher: (...keys: (string | number)[]) => fetch(keys.join('')).then((r) => r.json()), | ||
}); | ||
@@ -89,6 +89,9 @@ ``` | ||
It accepts two arguments: **key** and **fetcher options**. | ||
It accepts two arguments: **key input** and **fetcher options**. | ||
```ts | ||
type KeyParts = undefined | Array<ReadableAtom<string | null | undefined> | string> | ||
type NoKey = null | undefined | void; | ||
type SomeKey = string | number; | ||
type KeyInput = SomeKey | Array<SomeKey | ReadableAtom<SomeKey | NoKey>>; | ||
``` | ||
@@ -104,3 +107,3 @@ | ||
// The async function that actually returns the data | ||
fetcher?: (...keyParts: string[]) => Promise<unknown>; | ||
fetcher?: (...keyParts: (string | number)[]) => Promise<unknown>; | ||
// How much time should pass between running fetcher for the exact same key parts | ||
@@ -107,0 +110,0 @@ // default = 4s |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33782
270
14