refactor: simplify the implementation of `isNullish` by tbouffard ยท Pull Request #989 ยท maxGraph/maxGraph

Walkthrough

Adds and exports isNullish(value: any): boolean in packages/core/src/internal/utils.ts, implemented using v == undefined. Tests in packages/core/__tests__/internal/utils.test.ts were added to assert true for null/undefined and false for common non-nullish values.

Changes

Cohort / File(s) Summary
Utility export
packages/core/src/internal/utils.ts
Added and exported isNullish(value: any): boolean implemented as v == undefined
Tests
packages/core/__tests__/internal/utils.test.ts
Imported isNullish and added tests asserting true for null/undefined and false for other values; existing matchBinaryMask tests unchanged

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 minutes

Possibly related PRs

๐Ÿšฅ Pre-merge checks | โœ… 2 | โŒ 1
โŒ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check โš ๏ธ Warning The pull request description is minimal and lacks required information from the template, including overview details, issue reference, and rationale for the change. Add a comprehensive overview explaining what problem the refactoring solves, include an issue reference (closes #xxxx), provide rationale for simplifying v === null || v === undefined to v == undefined, and confirm all PR checklist items.
โœ… Passed checks (2 passed)
Check name Status Explanation
Title check โœ… Passed The pull request title accurately describes the main change: simplifying the implementation of the isNullish function through refactoring.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

โœ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.

โœจ Finishing touches
  • ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/simplify_isNullish

๐Ÿ“œ Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between ea96130 and 01260b6.

๐Ÿ“’ Files selected for processing (1)
  • packages/core/__tests__/internal/utils.test.ts
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • packages/core/tests/internal/utils.test.ts
โฐ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build
  • GitHub Check: build (macos-14)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (ubuntu-24.04)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.