* Returns the callSite * @param {number} frameCount * @param {CallSiteOptions} options * @returns {CallSite[]}
(frameCount = 10, options)
| 553 | * @returns {CallSite[]} |
| 554 | */ |
| 555 | function getCallSites(frameCount = 10, options) { |
| 556 | // If options is not provided check if frameCount is an object |
| 557 | if (options === undefined) { |
| 558 | if (typeof frameCount === 'object') { |
| 559 | // If frameCount is an object, it is the options object |
| 560 | options = frameCount; |
| 561 | validateObject(options, 'options'); |
| 562 | if (options.sourceMap !== undefined) { |
| 563 | validateBoolean(options.sourceMap, 'options.sourceMap'); |
| 564 | } |
| 565 | frameCount = 10; |
| 566 | } else { |
| 567 | // If options is not provided, set it to an empty object |
| 568 | options = {}; |
| 569 | }; |
| 570 | } else { |
| 571 | // If options is provided, validate it |
| 572 | validateObject(options, 'options'); |
| 573 | if (options.sourceMap !== undefined) { |
| 574 | validateBoolean(options.sourceMap, 'options.sourceMap'); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | // Using kDefaultMaxCallStackSizeToCapture as reference |
| 579 | validateInteger(frameCount, 'frameCount', 1, 200); |
| 580 | // If options.sourceMaps is true or if sourceMaps are enabled but the option.sourceMaps is not set explicitly to false |
| 581 | if (options.sourceMap === true || (getOptionValue('--enable-source-maps') && options.sourceMap !== false)) { |
| 582 | return mapCallSite(binding.getCallSites(frameCount)); |
| 583 | } |
| 584 | return binding.getCallSites(frameCount); |
| 585 | }; |
| 586 | |
| 587 | // Public util.deprecate API |
| 588 | function deprecate(fn, msg, code, { modifyPrototype } = kEmptyObject) { |
no test coverage detected
searching dependent graphs…