包详细信息

json-bond

kossnocorp142MIT1.0.0

Type-safe JSON strings

bond, TypeScript, JSON

自述文件

JSON bond

JSON bond provides a way to add type-safety to JSON strings.

Installation

The library is available as an npm package. To install JSON bond, run:

npm install json-bond --save
# Or using Yarn:
yarn add json-bond

Usage

import { JSONBond, parse, stringify } from 'json-bond'

type Abc = { [char: string]: number }
const abc: Abc = { a: 1, b: 2 }

const json = stringify(abc)
//=> JSONBond<Abc>

const result = parse(json)
//=> Abc

Changelog

See the changelog.

License

MIT © Sasha Koss

更新日志

Changelog

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. This change log follows the format documented in Keep a CHANGELOG.

v1.0.0 - 2021-06-13

Changed

  • BREAKING: Use String instead of { json: string } to make the type simpler.

v0.1.0 - 2020-05-31

Initial release