Comparing version 0.8.1 to 0.8.2
@@ -0,1 +1,11 @@ | ||
<a name="0.8.2"></a> | ||
## [0.8.2](https://github.com/boosterfuels/archetype/compare/v0.8.1...v0.8.2) (2017-12-03) | ||
### Bug Fixes | ||
* **unmarshal:** don't use $transform on array if nested in child element ([78bc272](https://github.com/boosterfuels/archetype/commit/78bc272)), closes [#13](https://github.com/boosterfuels/archetype/issues/13) | ||
<a name="0.8.1"></a> | ||
@@ -2,0 +12,0 @@ ## [0.8.1](https://github.com/boosterfuels/archetype/compare/v0.8.0...v0.8.1) (2017-10-19) |
{ | ||
"name": "archetype", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"author": "Valeri Karpov <val@boosterfuels.com>", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -54,3 +54,9 @@ # archetype | ||
* [20171013](https://gist.github.com/vkarpov15/1520cfb604972e81198db028e4606809) | ||
* [20171006](https://gist.github.com/vkarpov15/e03dafb2ac478cb38ff3fbe4c36139d6) | ||
* 20171124: [Embedding Only Certain Fields in an Embedded Archetype](https://gist.github.com/vkarpov15/37622608b33eb144acfda5d3ad936be6) | ||
* 20171117: [Async/Await with Archetype](https://gist.github.com/vkarpov15/f10b560468f49166bcc14c6e41bb755e) | ||
* 20171110: [Configuring Custom Validators for Individual Paths in Archetype](https://gist.github.com/vkarpov15/dcf7c490c69e625764c0dc1453555524) | ||
* 20171103: [Conditionally Required Properties with Archetype](https://gist.github.com/vkarpov15/b4a9cb225699b3bf852c3fa8ca2c56e2) | ||
* 20171027: [Custom Types with Archetype](https://gist.github.com/vkarpov15/d4cbd7941b40346741cf791d379001e5) | ||
* 20171020: [Embedding a Subset of One Archetype's Properties in another Archetype](https://gist.github.com/vkarpov15/0dc21e98acfb96e72d0bb9b602adb3ad) | ||
* 20171013: [Embedded Objects vs Embedded Types in Archetype](https://gist.github.com/vkarpov15/1520cfb604972e81198db028e4606809) | ||
* 20171006: [Consistent Arrays from Query Params with Express and Archetype](https://gist.github.com/vkarpov15/e03dafb2ac478cb38ff3fbe4c36139d6) |
@@ -104,4 +104,4 @@ 'use strict'; | ||
debug('newPath', newPath, schema._paths[newPath].$type); | ||
const pathOptions = schema._paths[newPath]; | ||
arr.forEach(function(value, index) { | ||
const pathOptions = schema._paths[newPath]; | ||
if (pathOptions.$transform != null) { | ||
@@ -134,3 +134,3 @@ try { | ||
try { | ||
handleCast(arr, index, pathOptions.$type, pathOptions.$transform); | ||
handleCast(arr, index, pathOptions.$type); | ||
} catch(err) { | ||
@@ -137,0 +137,0 @@ error.markError(join(path, index, true), err); |
@@ -640,2 +640,25 @@ 'use strict'; | ||
it('$transform', function() { | ||
const Name = new Archetype({ | ||
first: { $type: 'string' }, | ||
last: { $type: 'string' } | ||
}).compile('Name'); | ||
const Test = new Archetype({ | ||
names: [{ $type: Name, $transform: JSON.parse }] | ||
}).compile(); | ||
const doc = new Test({ | ||
names: [ | ||
JSON.stringify({ first: 'James', last: 'Kirk' }), | ||
JSON.stringify({ first: 'Leonard', last: 'McCoy' }) | ||
] | ||
}); | ||
assert.deepEqual(doc, { | ||
names: [ | ||
{ first: 'James', last: 'Kirk' }, | ||
{ first: 'Leonard', last: 'McCoy' } | ||
] | ||
}); | ||
}); | ||
it('$transform errors', function() { | ||
@@ -642,0 +665,0 @@ const Test = new Archetype({ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
62
58046
18
1394