add README

This commit is contained in:
Philipp Kunz 2017-02-27 15:35:43 +01:00
parent 04ba9253f4
commit 9f7c7a1462
2 changed files with 55 additions and 0 deletions

View File

@ -1,3 +1,4 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmts
stages:
@ -10,6 +11,7 @@ testLEGACY:
stage: test
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
@ -18,6 +20,7 @@ testLTS:
stage: test
script:
- npmci test lts
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
@ -25,6 +28,7 @@ testSTABLE:
stage: test
script:
- npmci test stable
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker

51
README.md Normal file
View File

@ -0,0 +1,51 @@
# smartjson
typed json handlers
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartjson)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartjson)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartjson)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartjson/)
## Status for master
[![build status](https://GitLab.com/pushrocks/smartjson/badges/master/build.svg)](https://GitLab.com/pushrocks/smartjson/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartjson/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartjson/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartjson.svg)](https://www.npmjs.com/package/smartjson)
[![Dependency Status](https://david-dm.org/pushrocks/smartjson.svg)](https://david-dm.org/pushrocks/smartjson)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartjson/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartjson/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartjson/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartjson)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
Use TypeScript for best in class instellisense.
### Classes
SmartJson makes it easy to fold and enfold classes into and from JSON
```javascript
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](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)