Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function defineProps(constructor) {
if (constructor.hasOwnProperty('_propsNormalized')) return;
const { props } = constructor;
keys(props).forEach(name => {
let func = props[name] || props.any;
if (defaultTypesMap.has(func)) func = defaultTypesMap.get(func);
if (typeof func !== 'function') func = prop(func);
func({ constructor }, name);
});
}
set props(props) {
const ctorProps = this.constructor.props;
keys(props).forEach(k => k in ctorProps && (this[k] = props[k]));
}
get props() {
return keys(this.constructor.props).reduce((prev, curr) => {
prev[curr] = this[curr];
return prev;
}, {});
}