Skip to main content

Built and signed on GitHub Actions

No-op Storage Module

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 months ago (0.4.0)
import 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(); }