This package has been deprecated

Author message:

This package has been deprecated in favour of the new package at @push.rocks/smartjson

@pushrocks/smartjson
TypeScript icon, indicating that this package has built-in type declarations

5.0.6 • Public • Published

@pushrocks/smartjson

typed json handlers

Availabililty and Links

Status for master

Status Category Status Badge
GitLab Pipelines pipeline status
GitLab Pipline Test Coverage coverage report
npm npm downloads per month
Snyk Known Vulnerabilities
TypeScript Support TypeScript
node Support node
Code Style Code Style
PackagePhobia (total standalone install weight) PackagePhobia
PackagePhobia (package size on registry) PackagePhobia
BundlePhobia (total size when bundled) BundlePhobia

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}
// You can also fold to Json, with support for buffers
// const jsonString = myAwesomeInstance.foldToJson();
myAwesomeInstance = AwesomeClass.enfoldFromObject({ anotherValueToStore: 'hi' });
foldedObject = myAwesomeInstance.foldToObject(); // will return {anotherValueToStore: 'hi'}

Contribution

We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can contribute one time or contribute monthly. :)

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

Legal

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

Readme

Keywords

none

Package Sidebar

Install

npm i @pushrocks/smartjson

Weekly Downloads

49

Version

5.0.6

License

MIT

Unpacked Size

18.1 kB

Total Files

12

Last publish

Collaborators

  • lossless