1.0.1 • Published 7 years ago

smartjson v1.0.1

Weekly downloads
11
License
MIT
Repository
gitlab
Last release
7 years ago

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

1.0.1

7 years ago

1.0.0

7 years ago