Skip to content

Blindly use JSON.parse when transforming response data #55

@mzabriskie

Description

@mzabriskie

Perf isn't that much better using RegExp before hand to determine if String is JSON. This also causes problems b/c YAML can look like JSON in some cases, but throws an Exception when attempting to parse. If using try/catch is needed for the second case anyway, just abandon the RegExp all together.

Benchmarks: https://gist.github.com/mzabriskie/fe85e6ea69b5049d17dd

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