UNPKG

tuya-panel-kit

Version:

a functional component library for developing tuya device panels!

25 lines (22 loc) 520 B
/* eslint-disable no-param-reassign */ /** * https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_pick */ export const pick = (object, keys) => { return keys.reduce((obj, key) => { if (typeof object[key] !== 'undefined') { obj[key] = object[key]; } return obj; }, {}); }; export const omit = (object, keys) => { const shallowCopy = { ...object, }; for (let i = 0; i < keys.length; i++) { const key = keys[i]; delete shallowCopy[key]; } return shallowCopy; };