Skip to content

feat(isNotCoercible): add isNotCoercible as complement of isCoercible #3430

Description

@char0n

Context

isCoercible was promoted to the public API in #3429. Many isFoo functions in ramda-adjunct have an isNotFoo complement (e.g. isSymbol/isNotSymbol, isPrimitive/isNotPrimitive).

Question: is isNotCoercible actually useful?

isNotCoercible would be complement(isCoercible), returning true only for:

  • Symbol values
  • Objects with no toString or valueOf in their prototype chain (e.g. Object.create(null))

That is a very narrow set. In practice, if you need to guard against a TypeError on numeric coercion you already have isCoercible for the positive path. A dedicated isNotCoercible might only add noise.

Contrast with functions that have natural complements:

  • isBlank / (no isNotBlank) — similar situation
  • isSentinelValue / (no isNotSentinelValue) — similar situation

Proposal

Add isNotCoercible only if there is a demonstrated use case. If the consensus is that it adds no practical value, close this issue as wontfix.

Implementation (if accepted)

// src/isNotCoercible.js
import { complement } from 'ramda';
import isCoercible from './isCoercible.js';

const isNotCoercible = complement(isCoercible);
export default isNotCoercible;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions