@commodo/fields
Advanced tools
Comparing version 0.2.5 to 0.2.6
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -10,18 +8,15 @@ value: true | ||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
const createField = (_ref) => { | ||
let { | ||
type, | ||
list, | ||
validation, | ||
get, | ||
set | ||
} = _ref, | ||
rest = (0, _objectWithoutProperties2.default)(_ref, ["type", "list", "validation", "get", "set"]); | ||
return function (parent) { | ||
this.parent = parent; | ||
const createField = ({ | ||
type, | ||
list, | ||
validation, | ||
get, | ||
set, | ||
value | ||
}) => { | ||
return function (name, parent) { | ||
this.get = get; | ||
this.set = set; | ||
this.name = ""; | ||
this.name = name; | ||
this.parent = parent; | ||
this.type = type; | ||
@@ -98,5 +93,6 @@ this.list = list; | ||
typeof this.construct === "function" && this.construct(); | ||
typeof this.init === "function" && this.init(); | ||
if ("value" in rest) { | ||
this.setValue(rest.value); | ||
if (typeof value !== "undefined") { | ||
this.setValue(value); | ||
} | ||
@@ -103,0 +99,0 @@ }; |
{ | ||
"name": "@commodo/fields", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"main": "index.js", | ||
@@ -31,3 +31,3 @@ "repository": { | ||
}, | ||
"gitHead": "c520a46ef8589ffdd9ce4c34583be5fd6da49671" | ||
"gitHead": "2b3250e5ee7de76475e48a509309acee3a7cbacb" | ||
} |
@@ -27,3 +27,3 @@ "use strict"; | ||
const valueFactory = fieldsList[newFieldName]; | ||
instance.__withFields.fields[newFieldName] = new valueFactory(); | ||
instance.__withFields.fields[newFieldName] = new valueFactory(newFieldName, instance); | ||
Object.defineProperty(instance, newFieldName, { | ||
@@ -47,8 +47,2 @@ get() { | ||
}); | ||
instance.__withFields.fields[newFieldName].name = newFieldName; | ||
instance.__withFields.fields[newFieldName].parent = instance; | ||
if (typeof instance.__withFields.fields[newFieldName].init === "function") { | ||
instance.__withFields.fields[newFieldName].init(); | ||
} | ||
} | ||
@@ -55,0 +49,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
66815
734