-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add util for using nested key definitions in ngrx-local-storage…
…-sync (#519) * feat: add util for using nested key definitions in ngrx-local-storage-sync * fix: rename method --------- Co-authored-by: SchettlerKoehler <[email protected]>
- Loading branch information
1 parent
3993c50
commit 81137cf
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
libs/ngrx-accelerator/src/lib/utils/local-storage/create-nested-key-configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export interface Options { | ||
serialize?: (state: any) => any | ||
deserialize?: (state: any) => any | ||
reviver?: (key: string, value: any) => any | ||
replacer?: ((key: string, value: any) => any) | string[] | ||
encrypt?: (message: string) => string | ||
decrypt?: (message: string) => string | ||
filter?: string[] | ||
space?: string | number | ||
} | ||
|
||
type CommonKeyConfigurationTypes = Options | ((key: string, value: any) => any) | ||
|
||
export interface KeyConfiguration { | ||
[key: string]: string[] | number[] | KeyConfiguration[] | CommonKeyConfigurationTypes | ||
} | ||
|
||
export interface NestedKeyConfiguration { | ||
[key: string]: (string | number | NestedKeyConfiguration)[] | CommonKeyConfigurationTypes | ||
} | ||
|
||
export function createNestedKeyConfiguration(nestedKeyConfiguration: (string | NestedKeyConfiguration)[]): KeyConfiguration[] { | ||
return nestedKeyConfiguration as KeyConfiguration[] | ||
} |