A library for handling typed JSON data, providing functionalities for parsing, stringifying, and working with JSON objects, including support for encoding and decoding buffers.
Go to file
2017-02-27 15:36:36 +01:00
dist initial 2017-02-27 14:05:03 +01:00
test initial 2017-02-27 14:05:03 +01:00
ts initial 2017-02-27 14:05:03 +01:00
.gitignore initial 2017-02-27 14:05:03 +01:00
.gitlab-ci.yml add README 2017-02-27 15:35:43 +01:00
package.json 1.0.1 2017-02-27 15:36:36 +01:00
README.md add README 2017-02-27 15:35:43 +01:00
tsconfig.json initial 2017-02-27 14:05:03 +01:00
tslint.json initial 2017-01-28 15:23:26 +01:00
yarn.lock initial 2017-02-27 14:05:03 +01:00

smartjson

typed json handlers

Availabililty

npm git git docs

Status for master

build status coverage report npm downloads per month Dependency Status bitHound Dependencies bitHound Code TypeScript node JavaScript Style Guide

Usage

Use TypeScript for best in class instellisense.

Classes

SmartJson makes it easy to fold and enfold classes into and from JSON

import { Foldable, foldDec } from 'smartjson'

class AwesomeClass extends Foldable {
  computedValue: string

  @foldDec() // mark anotherValueToStore as foldable
  anotherValueToStore: string = null
  constructor () {
    super() // this is important
  }
}

let myAwesomeInstance = new AwesomeClass()
let foldedObject = myAwesomeInstance.foldToObject() // will return {anotherValueToStore: null}
myAwesomeInstance.enfoldFromObject({anotherValueToStore: 'hi'})
foldedObject = myAwesomeInstance.foldToObject() // will return {anotherValueToStore: 'hi'}

For further information read the linked docs at the top of this README.

MIT licensed | © Lossless GmbH | By using this npm module you agree to our privacy policy

repo-footer