Comparing version 1.11.0 to 1.11.1
@@ -40,6 +40,10 @@ /** | ||
/** | ||
* A Function invoked per iteration | ||
* @param {} iteratee The current element to transform | ||
* @param source The source input to transform | ||
* @param target The current element transformed | ||
* @interface ActionFunction | ||
* @description A Function invoked per iteration | ||
* @param {S} iteratee The current element to transform | ||
* @param {S|S[]} source The source input to transform | ||
* @param {D} target The current element transformed | ||
* @typeparam D Destination / Target type | ||
* @typeparam S Source / Input type | ||
* @typeparam R Inferred result type | ||
* @example | ||
@@ -69,3 +73,3 @@ * ```typescript | ||
/** | ||
* A String path that indicates where to find the property in the source input | ||
* @description A String path that indicates where to find the property in the source input | ||
* | ||
@@ -84,7 +88,8 @@ * @example | ||
* foo: 'foo', // Simple Projection | ||
* bazqux: 'baz.qux' // Grab a value from a nested property | ||
* bar: 'bar[0]', // Grab a value from an array | ||
* bazqux: 'baz.qux' // Grab a value from a nested property, | ||
* }; | ||
* | ||
* morphism(schema, source); | ||
* //=> { foo: 'baz', bazqux: 'bazqux' } | ||
* //=> { foo: 'baz', bar: 'bar', bazqux: 'bazqux' } | ||
* ``` | ||
@@ -114,4 +119,8 @@ * | ||
/** | ||
* An Object that allows to perform a function over a source property's value | ||
* @interface ActionSelector | ||
* @typeparam Source Source/Input Type | ||
* @typeparam R Result Type | ||
* | ||
* @description An Object that allows to perform a function over a source property's value | ||
* | ||
* @example | ||
@@ -118,0 +127,0 @@ * ```typescript |
{ | ||
"name": "morphism", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"description": "Do not repeat anymore your objects transformations.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/nobrainr/morphism", |
@@ -34,2 +34,3 @@ # Morphism | ||
- [1. The Schema](#1-the-schema) | ||
- [Schema actions](#schema-actions) | ||
- [Schema Example](#schema-example) | ||
@@ -108,3 +109,3 @@ - [1.1 Using a strict Schema](#11-using-a-strict-schema) | ||
You may specify properties deep within the source object to be copied to your desired target by using dot notation in the mapping `value`. | ||
This is [one of the actions available]() to transform the source data | ||
This is [one of the actions available](#schema-actions) to transform the source data | ||
@@ -207,13 +208,14 @@ ```typescript | ||
![schema](https://raw.githubusercontent.com/nobrainr/morphism/fix/update-documentation/images/schema-required-fields.png) | ||
![schema](https://raw.githubusercontent.com/nobrainr/morphism/master/images/schema.png) | ||
![schema](https://raw.githubusercontent.com/nobrainr/morphism/fix/update-documentation/images/schema.png) | ||
![schema-required-fields](https://raw.githubusercontent.com/nobrainr/morphism/master/images/schema-required-fields.png) | ||
This library uses TypeScript extensively. The target type will be inferred from the defined schema. | ||
![inferred field type](https://raw.githubusercontent.com/nobrainr/morphism/fix/update-documentation/images/inferred-field-type.png) | ||
![inferred field type](https://raw.githubusercontent.com/nobrainr/morphism/master/images/inferred-field-type.png) | ||
When using an [`ActionFunction`](https://morphism.now.sh/modules/morphism#actionfunction) the input type is also inferred to enforce your transformations | ||
![typed action function](https://raw.githubusercontent.com/nobrainr/morphism/fix/update-documentation/images/ts-action-function.png) | ||
![typed action function](https://raw.githubusercontent.com/nobrainr/morphism/master/images/ts-action-function.png) | ||
@@ -234,9 +236,11 @@ See below the different options you have for the schema. | ||
You can use **4 kind of values** in your schema: | ||
#### Schema actions | ||
- [`ActionString`](https://morphism.now.sh/modules/morphism#actionstring): A string that allows to perform a projection from a property | ||
- [`ActionSelector`](https://morphism.now.sh/modules/morphism#actionselector): An Object that allows to perform a function over a source property's value | ||
- [`ActionFunction`](https://morphism.now.sh/modules/morphism#actionfunction): A Function that allows to perform a function over source property | ||
- [`ActionAggregator`](https://morphism.now.sh/modules/morphism#actionaggregator): An Array of Strings that allows to perform a function over source property | ||
You can use **4 kind of values** for the keys of your schema: | ||
- [`ActionString`](https://morphism.now.sh/modules/_types_#actionstring): A string that allows to perform a projection from a property | ||
- [`ActionSelector`](https://morphism.now.sh/interfaces/_types_.actionselector): An Object that allows to perform a function over a source property's value | ||
- [`ActionFunction`](https://morphism.now.sh/interfaces/_types_.actionfunction): A Function that allows to perform a function over source property | ||
- [`ActionAggregator`](https://morphism.now.sh/modules/_types_#actionaggregator): An Array of Strings that allows to perform a function over source property | ||
#### Schema Example | ||
@@ -651,3 +655,3 @@ | ||
[twitter-account]: https://twitter.com/renaudin_yann | ||
[twitter-account]: https://twitter.com/YannRenaudin | ||
[npm-image]: https://badge.fury.io/js/morphism.svg?style=flat-square | ||
@@ -654,0 +658,0 @@ [npm-url]: https://npmjs.org/package/morphism |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88438
471
659