Closed ilxqx closed 5 days ago
Thanks for the PR, @ilxqx. Just one thing: for functions that have type assertions, it's a good idea to include a type test to ensure that the types are working correctly. You can create the isNullish.test-d.ts
file based on other test files, such as the isArray test.
@ilxqx I find some lint errors in your changes, please run the pnpm lint
and fix the errors.
@aleclarson The strange part is the CI catches the error, but they do not show the error in the check result.
I'm going to try to find the CI problem
Hey @ilxqx, you should be able to run pnpm format
to fix the formatting errors. Let me know if you encounter any difficulties. :)
@MarlonPassos-git I have added type test for isNullish
and fixed the lint errors related to my committed file.
Hey @ilxqx, you should be able to run
pnpm format
to fix the formatting errors. Let me know if you encounter any difficulties. :)
I have run pnpm format
and committed the changed files. It seems that everything is ok now.
I would suggest that the docs mention that value == null
should be considered as an alternative, with proper lint rules to help enforce this pattern :)
@aeharding That's personally what I use, but it is somewhat prone to hard-to-debug typos, since people have a muscle memory for strict equals (===
).
Hey! There's a new requirement for PRs that introduce new features. Without this requirement met, we won't be able to merge this. Note that this PR can still be included in a beta
prerelease before this requirement is fulfilled.
⚠️ Note: You need to run git rebase main
before this file will appear locally.
Name | Current |
---|---|
isNullish: with null | 4,420,577.76 ops/sec ±0.07% |
isNullish: with undefined | 4,375,786.76 ops/sec ±0.07% |
isNullish: with number | 4,376,821.49 ops/sec ±0.07% |
isNullish: with string | 4,303,992.83 ops/sec ±0.08% |
isNullish: with array | 4,423,341.88 ops/sec ±0.07% |
Performance regressions of 30% or more should be investigated, unless they were anticipated. Smaller regressions may be due to normal variability, as we don't use dedicated CI infrastructure.
Hey! There's a new requirement for PRs that introduce new features. Without this requirement met, we won't be able to merge this. Note that this PR can still be included in a
beta
prerelease before this requirement is fulfilled.
- [ ] Edit the next-minor.md file
⚠️ Note: You need to run
git rebase main
before this file will appear locally.
Done!
Thanks for the contribution! Hope to see more from you in the future :v:
Summary
Add
isNullish
function to check if the given value isnull
orundefined
Related issue, if any:
For any code change,
Does this PR introduce a breaking change?
No
Bundle impact
src/typed/isNullish.ts
[^1337]: Function size includes the
import
dependencies of the function.