fix: make setItems and getItems work with prefixStorage #455
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
fix #396
β Type of change
π Description
When using setItems and getItems, prefixStorage can't handle base and key splice properly. storageKeyProperties doesn't contain setItems and getItems, and the original processing doesn't support passing parameters as arrays.
I added a regular expression to determine what type the current storageKey should be, and when it meets the condition, it will use traversal to splice the base and key together. The regular expression is now set to /(set|get)\w+s/, which I think should be backward compatible with APIs that conform to the naming convention, and since this processing is performed during traversal, it can be overridden later if the developer isn't happy with the established processing.
π Checklist