@nanostores/query
Advanced tools
Comparing version 0.2.0 to 0.2.1
import { MapStore, ReadableAtom } from "nanostores"; | ||
declare type NoKey = null | undefined | void; | ||
export declare type KeyInput = string | Array<string | ReadableAtom<string | NoKey>>; | ||
declare type SomeKey = string | number; | ||
export declare type KeyInput = SomeKey | Array<SomeKey | ReadableAtom<SomeKey | NoKey>>; | ||
declare type Key = string; | ||
declare type KeyParts = string[]; | ||
declare type KeyParts = SomeKey[]; | ||
declare type KeySelector = Key | Key[] | ((key: Key) => boolean); | ||
@@ -7,0 +8,0 @@ export declare type Fetcher<T> = (...args: KeyParts) => Promise<T>; |
@@ -253,5 +253,8 @@ import { map, onStart, onStop, atom } from "nanostores"; | ||
}; | ||
function isSomeKey(key) { | ||
return typeof key === "string" || typeof key === "number"; | ||
} | ||
const getKeyStore = (keys) => { | ||
if (typeof keys === "string") | ||
return [atom([keys, [keys]]), () => { | ||
if (isSomeKey(keys)) | ||
return [atom(["" + keys, [keys]]), () => { | ||
}]; | ||
@@ -269,3 +272,3 @@ let keyStore = atom(null), keyParts = []; | ||
const key = keys[i]; | ||
if (typeof key === "string") { | ||
if (isSomeKey(key)) { | ||
keyParts.push(key); | ||
@@ -272,0 +275,0 @@ continue; |
{ | ||
"name": "@nanostores/query", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Tiny remote data fetching library for Nano Stores", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
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
33984
665