Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* }
*/
if (!('type' in prop)) {
return prop()
}
/**
* properties: {
* foo: {
* type: String,
* },
* }
*/
return 'value' in prop ? prop.value : prop.type()
})
let observers = map(filter(properties, (key, prop) => {
return 'observer' in prop
}), (key, prop) => {
return prop.observer
})
properties = map(properties, (key, value) => {
if (!('type' in value)) {
return {
type: value,
value: value(),
observer () {},
}
}
return Object.assign({
}, value)
})
static diff (original, extra) {
return filter(original, (key, value) => value !== extra[key])
}
static diff (original, extra) {
return new SigmundData(filter(original, (key, value) => value !== extra[key] || original.signature(key) !== extra.signature(key)))
}
return () => {
let { isData, fromPlainObject, merge } = adapter
data = isData(data) ? data : fromPlainObject(clone(data))
if (typeof properties === 'object') {
let defaults = fromPlainObject(
map(
filter(
properties,
(name, property) => typeof property === 'object' && typeof property.value !== 'undefined',
),
(name, property) => property.value,
),
)
data = merge(data, defaults)
}
return data
}
}