UNPKG

@alwatr/local-storage

Version:

A modern, simple, and robust solution for managing versioned JSON objects in the browser's `localStorage`. This package provides a clean, class-based API with a factory function to ensure your application's data persistence is safe, maintainable, and futu

27 lines 873 B
/** * Configuration options for a local storage provider. */ export interface LocalStorageProviderConfig<T = unknown> { /** * The unique name for the storage item. */ name: string; /** * The version of the data structure. * Start from 1 for production, 0 for development mode, and increment by 1 for each new data schema change. */ schemaVersion: number; /** * Custom parser function for deserializing the stored string. * Useful for specialized data types like Maps, Sets, or Dates. * Defaults to `JSON.parse`. */ parse?: (value: string) => T; /** * Custom stringifier function for serializing the value. * Useful for specialized data types like Maps, Sets, or Dates. * Defaults to `JSON.stringify`. */ stringify?: (value: T) => string; } //# sourceMappingURL=type.d.ts.map