Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add util for using nested key definitions in ngrx-local-storage-sync #519

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libs/ngrx-accelerator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export * from './lib/utils/effects/filter-for-query-params-changed'
export * from './lib/utils/selectors/create-child-selectors'

// Local Storage
export * from './lib/utils/local-storage/lazy-loading-merge-reducer'
export * from './lib/utils/local-storage/lazy-loading-merge-reducer'
export * from './lib/utils/local-storage/create-nested-key-configuration'
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[]
}
Loading