• Generates derived, readable, writable helper functions wrapping the given Storage API provided with any additional customization for data serialization. By default, JSON serialization is used.

    Parameters

    • opts: {
          deserialize?: (value: string, ...rest: any[]) => any;
          serialize?: (value: any, ...rest: any[]) => string;
          storage: Storage;
      }

      Generator options.

      • Optionaldeserialize?: (value: string, ...rest: any[]) => any

        Replace with custom deserialization; default: JSON.parse.

      • Optionalserialize?: (value: any, ...rest: any[]) => string

        Replace with custom serialization; default: JSON.stringify.

      • storage: Storage

        The web storage source.

    Returns StorageStores

    A complete set of store helper functions and associated storage API instance and serialization strategy.