Skip to content

safeParse returns null rather than undefined, but null is a valid JSON value. #132

Closed
@Arlen22

Description

@Arlen22

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

safeParse returns null if parsing fails, but it should return undefined, because JSON.parse will never return undefined, but it will return null. 'null' is valid JSON, 'undefined' will throw. With it returning null, there is no way to tell that parsing failed.

You had one job! 😢 Ok, technically that wasn't your one job. But now I guess I'll have to fork it just to change that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions