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(persist-state): 🔥 excludeKeys operator #135

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

hakimio
Copy link
Contributor

@hakimio hakimio commented Feb 4, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #129

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Discussion

@hakimio hakimio changed the title feat(persist-state): 🔥 excludeKeys function feat(persist-state): 🔥 excludeKeys operator Feb 4, 2022
@@ -80,3 +80,19 @@ export const persist = persistState(authStore, {
storage: localForage,
});
```

## Excluding keys from saved state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Excluding keys from saved state
## Excluding keys from the state


## Excluding keys from saved state

`excludeKeys()` operator can be used to exclude some keys from saved state:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`excludeKeys()` operator can be used to exclude some keys from saved state:
The `excludeKeys()` operator can be used to exclude keys from the state:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't fixed those yet. Was the merge intentional?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, please fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I leave the operator name as is or do you want to rename it to omitKeys?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NetanelBasal thank you very much for all the awesome open source libraries you have created and articles you have written 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

key: 'todos',
storage: localStorageStrategy,
source: () => todoStore.pipe(
excludeKeys(['ids', 'entities'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that omitKeys is more suitable. See lodash naming for example https://lodash.com/docs/4.17.15#omit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a matter of personal preference. omit might be better because it's shorter and sounds a bit more formal, but exclude is more widely used word and when you have auto-completion in your IDE the length doesn't really matter.
Anyway, you can choose whichever you prefer.

@NetanelBasal NetanelBasal merged commit 1e6f48d into ngneat:master Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants