• 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.

          • (value, ...rest): any
          • Parameters

            • value: string
            • Rest...rest: any[]

            Returns any

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

        Replace with custom serialization; default: JSON.stringify.

          • (value, ...rest): string
          • Parameters

            • value: any
            • Rest...rest: any[]

            Returns string

      • storage: Storage

        The web storage source.

    Returns StorageStores

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