UNPKG

avg-core-ts

Version:

Develop Adventure Game (or ADV, Visual Novel, Galgame, etc.) on your own!

21 lines (17 loc) 509 B
/** * @file Util to combine props between * @author MicroMatrix <yangpan.1985@bytedance.com> * @copyright 2012-2020 bytedance * @link git@code.byted.org:yangpan.1985/avg.git */ export default function combineProps(props, filter) { const validKeys = Object.keys(filter); const keys = Object.keys(props); const newProps = {}; for (const key of keys) { if (validKeys.includes(key) && key !== 'children') { newProps[key] = props[key]; } } return newProps; }