Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

Commit

Permalink
docs: clarify that idAttribute functions
Browse files Browse the repository at this point in the history
  • Loading branch information
paularmstrong authored Aug 10, 2021
1 parent 6c57049 commit 3d0f233
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const normalizedData = normalize(data, myArray);
You _do not_ need to define any keys in your entity other than those that hold nested entities. All other values will be copied to the normalized entity's output.
- `options`:
- `idAttribute`: The attribute where unique IDs for each of this entity type can be found.
Accepts either a string `key` or a function that returns the IDs `value`. Defaults to `'id'`.
Accepts either a string `key` or a function that returns the IDs `value`. Defaults to `'id'`. This function can and will be run multiple times – which means your generated ID _must_ be the same every time the function is run. Using a random number/string generator like `uuid` will cause unexpected errors.
As a function, accepts the following arguments, in order:
- `value`: The input value of the entity.
- `parent`: The parent object of the input array.
Expand Down

0 comments on commit 3d0f233

Please sign in to comment.