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 wrapNullish() as an available option #153

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

tonyboylehub
Copy link
Contributor

wrapNullable didn't account for an undefined input and would result in a return value of some(undefined) causing isNone checks to not pass if undefined was the nullable value.

export const wrapNullable = <T>(nullable: Nullable<T>): Option<T> =>
  nullable !== null ? some(nullable) : none<T>();

Added a wrapNullish function to check for both null and undefined which will return the value of none() if null or undefined is the presented nullish value.

export const wrapNullish = <T>(nullish: Nullish<T>): Option<T> =>
  nullish !== null && nullish !== undefined ? some(nullish) : none<T>();
  • Nullish type added.
  • wrapNullish function added.
  • Tests for wrapNullish added.

Copy link

changeset-bot bot commented Oct 25, 2024

🦋 Changeset detected

Latest commit: f9033fa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@metaplex-foundation/umi-options Major
@metaplex-foundation/umi-serializers Major
@metaplex-foundation/umi Major
@metaplex-foundation/umi-bundle-defaults Major
@metaplex-foundation/umi-bundle-tests Major
@metaplex-foundation/umi-downloader-http Major
@metaplex-foundation/umi-eddsa-web3js Major
@metaplex-foundation/umi-http-fetch Major
@metaplex-foundation/umi-program-repository Major
@metaplex-foundation/umi-rpc-chunk-get-accounts Major
@metaplex-foundation/umi-rpc-web3js Major
@metaplex-foundation/umi-serializer-beet Major
@metaplex-foundation/umi-serializer-data-view Major
@metaplex-foundation/umi-signer-derived Major
@metaplex-foundation/umi-signer-wallet-adapters Major
@metaplex-foundation/umi-storage-mock Major
@metaplex-foundation/umi-transaction-factory-web3js Major
@metaplex-foundation/umi-uploader-aws Major
@metaplex-foundation/umi-uploader-bundlr Major
@metaplex-foundation/umi-uploader-irys Major
@metaplex-foundation/umi-uploader-nft-storage Major
@metaplex-foundation/umi-web3js-adapters Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umi-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 9:13pm

@tonyboylehub
Copy link
Contributor Author

@blockiosaurus before I merge this are we happy that all these packages are going up a major release?

@blockiosaurus
Copy link
Contributor

Yup that's fine by me.

@tonyboylehub tonyboylehub merged commit 68d49d9 into main Oct 29, 2024
8 checks passed
@tonyboylehub tonyboylehub deleted the feat/add-option-wrapNullish branch October 29, 2024 19:16
@github-actions github-actions bot mentioned this pull request Oct 29, 2024
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