(options, defaultOptions = kEmptyObject)
| 324 | } |
| 325 | |
| 326 | function getOptions(options, defaultOptions = kEmptyObject) { |
| 327 | if (options == null || typeof options === 'function') { |
| 328 | return defaultOptions; |
| 329 | } |
| 330 | |
| 331 | if (typeof options === 'string') { |
| 332 | defaultOptions = { ...defaultOptions }; |
| 333 | defaultOptions.encoding = options; |
| 334 | options = defaultOptions; |
| 335 | } else if (typeof options !== 'object') { |
| 336 | throw new ERR_INVALID_ARG_TYPE('options', ['string', 'Object'], options); |
| 337 | } |
| 338 | |
| 339 | if (options.encoding !== 'buffer') |
| 340 | assertEncoding(options.encoding); |
| 341 | |
| 342 | if (options.signal !== undefined) { |
| 343 | validateAbortSignal(options.signal, 'options.signal'); |
| 344 | } |
| 345 | |
| 346 | return options; |
| 347 | } |
| 348 | |
| 349 | /** |
| 350 | * @param {InternalFSBinding.FSSyncContext} ctx |
no test coverage detected
searching dependent graphs…