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

Add unsafeFromArray explainer to chunk.mdx #160

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Changes from 2 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
2 changes: 2 additions & 0 deletions pages/docs/data-types/chunk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Alternatively, you can create a `Chunk` by providing a collection of values. The
const fromUnsafeArray = Chunk.unsafeFromArray([1, 2, 3])
```

`Chunk.fromIterable` makes a chunk by cloning the iterable, which can be an expensive process for large iterables or when making many Chunks. `unsafeFromArray` doesn't do any cloning which can have performance benefits, but this breaks the assumption that Chunk is immutable.
gcanti marked this conversation as resolved.
Show resolved Hide resolved

<Warning>
It is important to note that using `unsafeFromArray` can potentially lead to
unsafe or unexpected behavior if the input array is mutated after conversion.
Expand Down
Loading