• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rm-hull / use-local-storage / 18979844385

31 Oct 2025 05:09PM UTC coverage: 90.123% (-1.1%) from 91.176%
18979844385

push

github

web-flow
feat: Support custom and async local storage serializers - fixes #3 (#30)

* feat: Support custom and async local storage serializers

Introduces the `Serializer` interface and allows passing a custom
serializer via hook options. This enables users to define custom
logic for transforming data before storage and after retrieval.

The primary use case is encrypting data or handling non-JSON
compatible objects. The implementation supports both synchronous
and asynchronous serialization/deserialization methods.

The default JSON serialization is now handled by the internal
`JsonSerializer`.

Includes documentation updates and refactors tests to handle
asynchronous serialization.

* Update src/useLocalStorageSerializer.spec.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Restore deleted tests

* Restore deleted tests

* Restore more deleted test cases

* Restore more deleted test cases

* Restore more deleted test cases

* Fix tests

* refactor: Reuse logic for reading storage value

Extracted the asynchronous read logic into a dedicated function,
`readValueFromStorage`.

This removes duplicated read and error handling logic between
the initial mount of the hook and the debounced storage change
listener.

Also applied minor formatting changes to `setValue`.

* Urgh..

* Ooof

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

21 of 26 branches covered (80.77%)

Branch coverage included in aggregate %.

19 of 20 new or added lines in 1 file covered. (95.0%)

52 of 55 relevant lines covered (94.55%)

43.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.12
/src/useLocalStorage.ts


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc