Skip to content

Commit

Permalink
Published version 1.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Gordon committed Sep 26, 2017
1 parent c924b62 commit f489e20
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ When deserializing a model elememt / property, the following fields are availabl

## ModelSchema

[src/serializr.js:52-52](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/serializr.js#L52-L52 "Source code on GitHub")
[src/serializr.js:52-52](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/serializr.js#L52-L52 "Source code on GitHub")

JSDOC type defintions for usage w/o typescript.

Expand Down Expand Up @@ -341,7 +341,7 @@ Returns **any** void

## createSimpleSchema

[src/api/createSimpleSchema.js:17-24](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/api/createSimpleSchema.js#L17-L24 "Source code on GitHub")
[src/api/createSimpleSchema.js:17-24](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/api/createSimpleSchema.js#L17-L24 "Source code on GitHub")

Creates a model schema that (de)serializes from / to plain javascript objects.
Its factory method is: `() => ({})`
Expand All @@ -366,7 +366,7 @@ Returns **[object](#object)** model schema

## createModelSchema

[src/api/createModelSchema.js:29-47](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/api/createModelSchema.js#L29-L47 "Source code on GitHub")
[src/api/createModelSchema.js:29-47](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/api/createModelSchema.js#L29-L47 "Source code on GitHub")

Creates a model schema that (de)serializes an object created by a constructor function (class).
The created model schema is associated by the targeted type as default model schema, see setDefaultModelSchema.
Expand Down Expand Up @@ -399,7 +399,7 @@ Returns **[object](#object)** model schema

## getDefaultModelSchema

[src/api/getDefaultModelSchema.js:9-18](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/api/getDefaultModelSchema.js#L9-L18 "Source code on GitHub")
[src/api/getDefaultModelSchema.js:9-18](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/api/getDefaultModelSchema.js#L9-L18 "Source code on GitHub")

Returns the standard model schema associated with a class / constructor function

Expand All @@ -411,7 +411,7 @@ Returns **[ModelSchema](#modelschema)** model schema

## setDefaultModelSchema

[src/api/setDefaultModelSchema.js:15-18](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/api/setDefaultModelSchema.js#L15-L18 "Source code on GitHub")
[src/api/setDefaultModelSchema.js:15-18](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/api/setDefaultModelSchema.js#L15-L18 "Source code on GitHub")

Sets the default model schema for class / constructor function.
Everywhere where a model schema is required as argument, this class / constructor function
Expand All @@ -429,7 +429,7 @@ Returns **[ModelSchema](#modelschema)** model schema

## serializable

[src/api/serializable.js:93-103](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/api/serializable.js#L93-L103 "Source code on GitHub")
[src/api/serializable.js:93-103](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/api/serializable.js#L93-L103 "Source code on GitHub")

Decorator that defines a new property mapping on the default model schema for the class
it is used in.
Expand All @@ -453,7 +453,7 @@ Returns **PropertyDescriptor**
## serialize
[src/core/serialize.js:16-34](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/core/serialize.js#L16-L34 "Source code on GitHub")
[src/core/serialize.js:16-34](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/core/serialize.js#L16-L34 "Source code on GitHub")
Serializes an object (graph) into json using the provided model schema.
The model schema can be omitted if the object type has a default model schema associated with it.
Expand All @@ -468,7 +468,7 @@ Returns **[object](#object)** serialized representation of the object
## serializeAll
[src/core/serialize.js:89-100](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/core/serialize.js#L89-L100 "Source code on GitHub")
[src/core/serialize.js:89-100](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/core/serialize.js#L89-L100 "Source code on GitHub")
The `serializeAll` decorator can be used on a class to signal that all primitive properties should be serialized automatically.
Expand All @@ -478,7 +478,7 @@ The `serializeAll` decorator can be used on a class to signal that all primitive
## deserialize
[src/core/deserialize.js:38-56](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/core/deserialize.js#L38-L56 "Source code on GitHub")
[src/core/deserialize.js:38-56](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/core/deserialize.js#L38-L56 "Source code on GitHub")
Deserializes a json structor into an object graph.
This process might be asynchronous (for example if there are references with an asynchronous
Expand All @@ -497,7 +497,7 @@ Returns **([object](#object) \| [array](https://developer.mozilla.org/en-US/docs
## update
[src/core/update.js:21-42](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/core/update.js#L21-L42 "Source code on GitHub")
[src/core/update.js:21-42](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/core/update.js#L21-L42 "Source code on GitHub")
Similar to deserialize, but updates an existing object instance.
Properties will always updated entirely, but properties not present in the json will be kept as is.
Expand All @@ -513,7 +513,7 @@ Further this method behaves similar to deserialize.
## primitive
[src/types/primitive.js:17-29](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/primitive.js#L17-L29 "Source code on GitHub")
[src/types/primitive.js:17-29](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/primitive.js#L17-L29 "Source code on GitHub")
Indicates that this field contains a primitive value (or Date) which should be serialized literally to json.
Expand All @@ -532,7 +532,7 @@ Returns **[ModelSchema](#modelschema)**
## identifier
[src/types/identifier.js:42-56](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/identifier.js#L42-L56 "Source code on GitHub")
[src/types/identifier.js:42-56](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/identifier.js#L42-L56 "Source code on GitHub")
Similar to primitive, but this field will be marked as the identifier for the given Model type.
This is used by for example `reference()` to serialize the reference
Expand Down Expand Up @@ -572,13 +572,13 @@ Returns **PropSchema**
## date
[src/types/date.js:8-23](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/date.js#L8-L23 "Source code on GitHub")
[src/types/date.js:8-23](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/date.js#L8-L23 "Source code on GitHub")
Similar to primitive, serializes instances of Date objects
## alias
[src/types/alias.js:20-31](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/alias.js#L20-L31 "Source code on GitHub")
[src/types/alias.js:20-31](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/alias.js#L20-L31 "Source code on GitHub")
Alias indicates that this model property should be named differently in the generated json.
Alias should be the outermost propschema.
Expand All @@ -603,7 +603,7 @@ Returns **PropSchema**
## custom
[src/types/custom.js:36-45](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/custom.js#L36-L45 "Source code on GitHub")
[src/types/custom.js:36-45](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/custom.js#L36-L45 "Source code on GitHub")
Can be used to create simple custom propSchema. Multiple things can be done inside of a custom propSchema, like deserializing and serializing other (polymorphic) objects, skipping the serialization of something or checking the context of the obj being (de)serialized.
Expand All @@ -622,7 +622,7 @@ When deserializing the object `{b: 2}` the `deserializer` function will be calle
**Parameters**
- `serializer` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function that takes a model value and turns it into a json value
- `deserializer` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function that takes a json value and turns it into a model value
- `deserializer` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function that takes a json value and turns it into a model value. It also takes context argument, which can allow you to deserialize based on the context of other parameters.
**Examples**
Expand All @@ -645,7 +645,7 @@ Returns **PropSchema**
## object
[src/types/object.js:34-52](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/object.js#L34-L52 "Source code on GitHub")
[src/types/object.js:34-52](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/object.js#L34-L52 "Source code on GitHub")
`object` indicates that this property contains an object that needs to be (de)serialized
using its own model schema.
Expand Down Expand Up @@ -682,7 +682,7 @@ Returns **PropSchema**
## reference
[src/types/reference.js:65-98](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/reference.js#L65-L98 "Source code on GitHub")
[src/types/reference.js:65-98](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/reference.js#L65-L98 "Source code on GitHub")
`reference` can be used to (de)serialize references that point to other models.
Expand Down Expand Up @@ -746,7 +746,7 @@ Returns **PropSchema**
## list
[src/types/list.js:33-54](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/list.js#L33-L54 "Source code on GitHub")
[src/types/list.js:33-54](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/list.js#L33-L54 "Source code on GitHub")
List indicates that this property contains a list of things.
Accepts a sub model schema to serialize the contents
Expand Down Expand Up @@ -784,7 +784,7 @@ Returns **PropSchema**
## map
[src/types/map.js:13-62](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/map.js#L13-L62 "Source code on GitHub")
[src/types/map.js:13-62](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/map.js#L13-L62 "Source code on GitHub")
Similar to list, but map represents a string keyed dynamic collection.
This can be both plain objects (default) or ES6 Map like structures.
Expand All @@ -796,7 +796,7 @@ This will be inferred from the initial value of the targetted attribute.
## mapAsArray
[src/types/mapAsArray.js:15-52](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/types/mapAsArray.js#L15-L52 "Source code on GitHub")
[src/types/mapAsArray.js:15-52](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/types/mapAsArray.js#L15-L52 "Source code on GitHub")
Similar to map, mapAsArray can be used to serialize a map-like collection where the key is contained in the 'value object'.
Example: consider Map<id: number, customer: Customer> where the Customer object has the id stored on itself.
Expand All @@ -811,7 +811,7 @@ For ES6 maps this has the benefit of being allowed to have non-string keys in th
## SKIP
[src/constants.js:20-20](https://github.com/mobxjs/serializr/blob/818822c70ea2f959256ca956a1fdfdffae5abd94/src/constants.js#L20-L20 "Source code on GitHub")
[src/constants.js:20-20](https://github.com/mobxjs/serializr/blob/c924b623c150db5caa92ae202b9ff87b953de710/src/constants.js#L20-L20 "Source code on GitHub")
In the event that a property needs to be deserialized, but not serialized, you can use the SKIP symbol to omit the property. This has to be used with the custom serializer.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serializr",
"version": "1.1.12",
"version": "1.1.13",
"description": "Serialize and deserialize complex object graphs to JSON",
"main": "lib/serializr.js",
"module": "lib/es/serializr.js",
Expand Down Expand Up @@ -57,4 +57,4 @@
"typescript": "^2.1.4",
"uglify-js": "^2.6.4"
}
}
}

0 comments on commit f489e20

Please sign in to comment.