LearnNewsExamplesServices
Frontmatter
id10838
titleRefactor Neo.isEmpty() internally and adopt it in EmbeddingProviderConfig
stateClosed
labels
enhancementairefactoring
assigneesneo-gemini-3-1-pro
createdAtMay 6, 2026, 7:36 PM
updatedAtMay 9, 2026, 11:23 PM
githubUrlhttps://github.com/neomjs/neo/issues/10838
authorneo-gemini-3-1-pro
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 6, 2026, 8:01 PM

Refactor Neo.isEmpty() internally and adopt it in EmbeddingProviderConfig

Closedenhancementairefactoring
neo-gemini-3-1-pro
neo-gemini-3-1-pro commented on May 6, 2026, 7:36 PM

Context

In PR #10836, we merged a cleanup in EmbeddingProviderConfig.mjs that introduced a local hasValue function. The operator pointed out that this is redundant because Neo.mjs already provides Neo.isEmpty(). Concurrently, the implementation of Neo.isEmpty() itself contains a verbose null/undefined check that can be optimized.

The Problem

  1. EmbeddingProviderConfig.mjs duplicates validation logic with a local hasValue function (const hasValue = value => value !== undefined && value !== null && value !== '';).
  2. Neo.isEmpty() currently uses strict equality for both null and undefined (value === null || value === undefined), which is unnecessarily verbose compared to loose equality.

The Architectural Reality

Neo.isEmpty() is a core utility method meant to prevent exactly this kind of localized hasValue recreation. Updating it to use loose equality (== null) is fully safe, captures both null and undefined, and reduces bytes. EmbeddingProviderConfig.mjs should import/rely on this core utility rather than duplicating logic.

The Fix

  1. Update Neo.isEmpty(): replace value === null || value === undefined with value == null.
  2. Add an explicit code comment in Neo.isEmpty() clarifying that == is intentional to catch both null and undefined.
  3. Update EmbeddingProviderConfig.mjs: drop hasValue and refactor the unified assignment to use !Neo.isEmpty(config.embeddingProvider).

Acceptance Criteria

  • Neo.isEmpty() uses value == null internally with an explanatory comment.
  • EmbeddingProviderConfig.mjs removes the local hasValue function.
  • EmbeddingProviderConfig.mjs uses !Neo.isEmpty() for config resolution.

Out of Scope

  • Widespread auditing of other uses of === null across the codebase; scope is strictly limited to Neo.isEmpty() and the recent EmbeddingProviderConfig change.

Origin Session ID: a82084a1-4ce1-4a50-b78d-68b3e60a473f

tobiu referenced in commit 1997c3a - "feat(core): Refactor Neo.isEmpty() to use loose equality (#10838) (#10839) on May 6, 2026, 8:01 PM
tobiu closed this issue on May 6, 2026, 8:01 PM