all-node-versions
Version:
List all available Node.js versions
18 lines (14 loc) • 430 B
JavaScript
import isPlainObj from"is-plain-obj";
export const getOpts=(opts={})=>{
if(!isPlainObj(opts)){
throw new TypeError(`Options must be a plain object: ${opts}`)
}
const{fetch:fetchOpt,...fetchNodeOpts}=opts;
validateFetch(fetchOpt);
return{fetchOpt,fetchNodeOpts}
};
const validateFetch=(fetchOpt)=>{
if(fetchOpt!==undefined&&typeof fetchOpt!=="boolean"){
throw new TypeError(`Option "fetch" must be a boolean: ${fetchOpt}`)
}
};