Skip to content

Lian1230/serialize-daggy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm PRs Welcome Open Source Love License

Currently only support taggedSum

Stringify and parse your Daggy

Install

yarn add serialize-daggy

Peer dependency on Daggy

yarn add daggy

Usage examples

import { stringify, parse } from "serialize-daggy"
import { taggedSum } from "daggy"

// example daggy type
const DaggyType = taggedSum("DaggyType", {
  Yes: ["value"],
  No: []
})

// obj to be serialized
const obj = {
  str: "string",
  num: 0,
  obj: { foo: "foo" },
  daggy_Yes: DaggyType.Yes("lol"),
  daggy_No: DaggyType.No,
  date: new Date("Thu, 28 Apr 2016 22:02:17 GMT")
}

// stringify daggy
const str = stringify(obj)

// put it back
const newObj = parse(str)

About

Serialize daggy type or object with daggy type

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published