source:
node_modules/es-toolkit/dist/object/pick.mjs
| Last change on this file was a762898, checked in by , 5 months ago | |
|---|---|
|
|
| File size: 253 bytes | |
| Line | |
|---|---|
| 1 | function pick(obj, keys) { |
| 2 | const result = {}; |
| 3 | for (let i = 0; i < keys.length; i++) { |
| 4 | const key = keys[i]; |
| 5 | if (Object.hasOwn(obj, key)) { |
| 6 | result[key] = obj[key]; |
| 7 | } |
| 8 | } |
| 9 | return result; |
| 10 | } |
| 11 | |
| 12 | export { pick }; |
Note:
See TracBrowser
for help on using the repository browser.
