@jollytoad/store-no-op@0.4.0Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
No-op Storage Module
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
JSR Score
100%
Published
3 months ago (0.4.0)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081import type { StorageKey, StorageModule } from "jsr:/@jollytoad/store-common@^0.4.0/types"; export type { StorageKey, StorageModule }; ({ isWritable, hasItem, getItem, setItem, removeItem, listItems, clearItems, close, url, }) satisfies StorageModule; /** * Returns the `import.meta.url` of the module. */ export function url(): Promise<string> { return Promise.resolve(import.meta.url); } /** * Always false, as this is not a real storage mechanism. */ export function isWritable(_key: StorageKey = []): Promise<boolean> { return Promise.resolve(false); } /** * Always false, as this store holds no data. */ export function hasItem(_key: StorageKey): Promise<boolean> { return Promise.resolve(false); } /** * Always undefined, as this store holds no data. */ export function getItem<T>(_key: StorageKey): Promise<T | undefined> { return Promise.resolve(undefined); } /** * Does nothing, as this is not a real storage mechanism. */ export function setItem<T>(_key: StorageKey, _value: T): Promise<void> { return Promise.resolve(); } /** * Does nothing, as this is not a real storage mechanism. */ export function removeItem(_key: StorageKey): Promise<void> { return Promise.resolve(); } /** * Lists nothing, as this store holds no data. */ export async function* listItems<T>( _prefix: StorageKey = [], _reverse = false, ): AsyncIterable<[StorageKey, T]> { // do nothing } /** * Does nothing, as this is not a real storage mechanism. */ export function clearItems(_prefix: StorageKey): Promise<void> { return Promise.resolve(); } /** * Does nothing, as this is not a real storage mechanism. */ export function close(): Promise<void> { return Promise.resolve(); }