Skip to content

Revert casted values #25

@panoply

Description

@panoply

Current behaviour

As of 3.7.0 the change to casted values is returning undefined which is not ideal and problematic with implementations where primitives should not be stringified.

Expected behaviour

Result should be empty string.

Reproduction Example

In the below example, foo is undefined, but it is not ansis job to cast that, failing silently is far better imo as per the previous versions. The argument for type checking before printing can also be a nuance because it is assumed behaviour based on alternative libs.

import ansis from 'ansis';

export const { cyan } = ansis

// assuming i have a function
const someFn = (foo) =>  cyan(foo)

someFn() // undefined is printed

Additional context

While the logic is good in theory, in practice it is not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions