UNPKG

taro-ui-vue3

Version:

Taro UI Rewritten in Vue 3.0

43 lines (42 loc) 1.39 kB
var __defProp = Object.defineProperty; var __hasOwnProp = Object.prototype.hasOwnProperty; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value; var __objSpread = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; function propsFactory(props) { return (defaults) => { if (!defaults) { return props; } else { return Object.keys(props).reduce((obj, prop) => { const definition = props[prop]; if (prop in defaults) { if (typeof definition === "object" && definition != null && !Array.isArray(definition)) { obj[prop] = __objSpread(__objSpread({}, definition), { default: defaults[prop] }); } else { obj[prop] = {type: props[prop], default: defaults[prop]}; } } else { obj[prop] = definition; } return obj; }, {}); } }; } export { propsFactory as default };