CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
get-options.js21 linesDownload Raw Back to common
1// given an input that may or may not be an object, return an object that has2// a copy of every defined property listed in 'copy'. if the input is not an3// 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] = input15  }16 17  return result18}19 20module.exports = getOptions21 
basant307/AI_Governance_Project · CoolFace