Skip to content

Commit

Permalink
Merge 22711e6 into 34b520c
Browse files Browse the repository at this point in the history
  • Loading branch information
talyssonoc committed Mar 22, 2019
2 parents 34b520c + 22711e6 commit fa44042
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 1.3.2 - 2019-03-22
Fix:
* The actual instance is passed to the dynamic defaults

## 1.3.0 - 2018-03-23
Enhancements:
* When using default function to initialize attributes you can now refer to another attribute values to compose value
Expand Down
14 changes: 9 additions & 5 deletions dist/structure.js
Expand Up @@ -665,6 +665,14 @@ return /******/ (function(modules) { // webpackBootstrap

var initializationOrderFor = __webpack_require__(20);

function initializedValue(attrPassedValue, attrInitializer, attrDescriptor, instance) {
if (attrPassedValue !== undefined) {
return attrPassedValue;
}

return attrInitializer(attrDescriptor, instance);
}

module.exports = function forSchema(schema) {
var initializationOrder = initializationOrderFor(schema);

Expand All @@ -680,11 +688,7 @@ return /******/ (function(modules) { // webpackBootstrap
var attrDescriptor = schema[attrName];
var attrPassedValue = attributes[attrName];

if (attrPassedValue !== undefined) {
instance[attrName] = attrPassedValue;
} else {
instance[attrName] = attrInitializer(attrDescriptor, instance);
}
instance[attrName] = initializedValue(attrPassedValue, attrInitializer, attrDescriptor, instance);
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "structure",
"version": "1.3.1",
"version": "1.3.2",
"description": "A simple schema/attributes library built on top of modern JavaScript",
"main": "src/index.js",
"browser": "dist/structure.js",
Expand Down

0 comments on commit fa44042

Please sign in to comment.