sarala-json-api-data-formatter
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "sarala-json-api-data-formatter", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Simple and fluent framework agnostic javascript library to transform standard JSON API responses to simple JSON objects and vice versa.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
# sarala-json-api-data-formatter | ||
> Simple and fluent framework agnostic javascript library to transform standard JSON API responses to simple JSON objects and vice versa. | ||
> A fluent, framework-agnostic, JavaScript library, that can be used simply, to transform standard JSON API responses to simple JSON objects and vice versa. | ||
@@ -14,3 +14,3 @@ ## Install | ||
## JSON-API response data | ||
## JSON-API response data sample | ||
@@ -26,3 +26,3 @@ ```javascript | ||
"title": "Sarala json-api data formatter", | ||
"subtitle": "Simple and fluent framework agnostic javascript library to transform standard JSON API responses to simple JSON objects and vice versa.", | ||
"subtitle": "A fluent, framework-agnostic, JavaScript library, that can be used simply, to transform standard JSON API responses to simple JSON objects and vice versa.", | ||
"published_at": "2018-01-21" | ||
@@ -65,3 +65,3 @@ }, | ||
## Simple object data | ||
## Simple object data sample | ||
@@ -75,3 +75,3 @@ ```javascript | ||
"title": "Sarala json-api data formatter", | ||
"subtitle": "Simple and fluent framework agnostic javascript library to transform standard JSON API responses to simple JSON objects and vice versa.", | ||
"subtitle": "A fluent, framework-agnostic, JavaScript library, that can be used simply, to transform standard JSON API responses to simple JSON objects and vice versa.", | ||
"published_at": "2018-01-21", | ||
@@ -100,2 +100,4 @@ "relationships": [ | ||
```javascript | ||
import { Formatter } from "sarala-json-api-data-formatter"; | ||
const formatter = new Formatter(); | ||
@@ -109,5 +111,7 @@ | ||
```javascript | ||
import { Formatter } from "sarala-json-api-data-formatter"; | ||
const formatter = new Formatter(); | ||
let data = this.deserialize(data); | ||
let data = this.serialize(data); | ||
``` | ||
@@ -117,3 +121,3 @@ | ||
#### deserialize only root objects and skipp all relationships | ||
#### Deserialize only root objects and skip all relationships | ||
@@ -124,5 +128,5 @@ ```javascript | ||
#### deserialize only specific relationships | ||
#### Deserialize only specific relationships | ||
when post has tags and comments, following will deserialize only root object and comments. tags will be skipped. | ||
When post has tags and comments, following will deserialize only root object and comments. Tags will be skipped. | ||
@@ -135,3 +139,3 @@ ```javascript | ||
#### deserialize only specified fields | ||
#### Deserialize only specified fields | ||
@@ -141,6 +145,6 @@ ```javascript | ||
posts: ['title', 'subtitle'], | ||
tag: ['name'] | ||
tags: ['name'] | ||
}).deserialize(data); | ||
``` | ||
#### In the same way you can use `includeOnly` and `filterFields` with `serialize` method. | ||
### The `serialize` method can be used similarly with `includeOnly` and `filterFields`. |
16207
140