Skip to content

Add string.boolean.parse keyword #1621

@aelesia

Description

@aelesia

Request a feature

Add string.boolean.parse to support parsing boolean strings

🤷 Motivation

string.integer.parse and string.numeric.parse exist, but there's no equivalent for booleans. Parsing "true"/"false" strings from environment variables, query params, and serialized data is a common use case.

💡 Solution

Add string.boolean and string.boolean.parse following the exact same pattern as stringInteger/stringNumeric in string.ts. Validate that the string is "true" | "false", then morph it into a boolean


Happy to open a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions