JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 100
  • Score
    100M100P100Q7824F
  • License MIT

typed json handlers

Package Exports

  • @pushrocks/smartjson

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@pushrocks/smartjson) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@pushrocks/smartjson

typed json handlers

Status for master

build status coverage report npm downloads per month Known Vulnerabilities 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 { Smartjson, foldDec } from 'smartjson';

class AwesomeClass extends Smartjson {
  static stringify


  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