source: node_modules/@npmcli/fs/lib/common/get-options.js@ 81bc7da

finki-main main
Last change on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 528 bytes
Line 
1// given an input that may or may not be an object, return an object that has
2// a copy of every defined property listed in 'copy'. if the input is not an
3// object, assign it to the property named by 'wrap'
4const getOptions = (input, { copy, wrap }) => {
5 const result = {}
6
7 if (input && typeof input === 'object') {
8 for (const prop of copy) {
9 if (input[prop] !== undefined) {
10 result[prop] = input[prop]
11 }
12 }
13 } else {
14 result[wrap] = input
15 }
16
17 return result
18}
19
20module.exports = getOptions
Note: See TracBrowser for help on using the repository browser.