(object, keys)
| 5 | * @returns {Object} |
| 6 | */ |
| 7 | const pick = (object, keys) => { |
| 8 | return keys.reduce((obj, key) => { |
| 9 | if (object && Object.prototype.hasOwnProperty.call(object, key)) { |
| 10 | // eslint-disable-next-line no-param-reassign |
| 11 | obj[key] = object[key]; |
| 12 | } |
| 13 | return obj; |
| 14 | }, {}); |
| 15 | }; |
| 16 | |
| 17 | module.exports = pick; |
no outgoing calls
no test coverage detected