The stored object
Whether or not to look for existing values before using the defaults passed
Whether or not to check localStorage when an object key is retrieved
Whether to modify values on the proxied object or leave it as-is.
Doesn't do anything if passed with partial
for storeObject
Whether the stored object only contains/stores some of the keys on the serialized object. This is useful if you want an object to look at only some keys of a localStorage object without overwriting the other ones.
It's important to note that passing this option effectively enables key validation: any keys that were not passed are ignored and not passed to validate or modify
Called whenever a key should be retrieved
The key's value
Modify an object before setting it in localStorage or reading it. Called after validate. Any valiation should be done in validate and not here
A potentially modified version of the object originally passed
Function to parse object. Defaults to JSON.parse
.
Any validation should NOT be done here, but in the validate method
Called whenever a key should be set
The value being set
Function to stringify object. Defaults to JSON.stringify
.
Any validation should NOT be done here, but in the validate method
Validate an object before setting it in localStorage or reading it. Can confirm/deny if the object is valid, along with an optional error message if it is invalid
A boolean to confirm validity or false and optionally an Error instance to deny validity
Generated using TypeDoc
Configuration for StoreObjectConfig