Socket
Book a DemoInstallSign in
Socket

fp-ts-json

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fp-ts-json

Safe json methods with fp-ts

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Safe json methods with fp-ts

import {stringify, parse} from './'
import * as E from 'fp-ts/lib/Either'
import * as assert from 'assert'

assert.deepStrictEqual(stringify({
    foo: "bar"
}), E.either.of(JSON.stringify({
    foo: "bar"
})))

const circularReference: any = {};
circularReference.myself = circularReference;

assert(E.isLeft(stringify(circularReference)))

assert.deepStrictEqual(parse(
    JSON.stringify({
        foo: "bar"
    })
), E.either.of({
    foo: "bar"
}))

assert(E.isLeft(parse("abc")))

Keywords

fp-ts

FAQs

Package last updated on 14 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts