MCPcopy Index your code
hub / github.com/ehmicky/log-process-errors / getOptions

Function getOptions

src/options.js:9–25  ·  view source on GitHub ↗
(opts = {})

Source from the content-addressed store, hash-verified

7
8// Validate options and assign default options
9export const getOptions = (opts = {}) => {
10 if (!isPlainObj(opts)) {
11 throw new TypeError(`Options must be a plain object: ${opts}`)
12 }
13
14 const { exit, onError = defaultOnError, ...unknownOpts } = opts
15
16 validateExit(exit)
17
18 if (typeof onError !== 'function') {
19 throw new TypeError(`Option "onError" must be a function: ${onError}`)
20 }
21
22 validateUnknownOpts(unknownOpts)
23
24 return { exit, onError }
25}
26
27const validateExit = (exit) => {
28 if (exit !== undefined && typeof exit !== 'boolean') {

Callers 2

logProcessErrorsFunction · 0.90
validateOptionsFunction · 0.85

Calls 2

validateExitFunction · 0.85
validateUnknownOptsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…