You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
687 B
19 lines
687 B
'use strict'; |
|
|
|
var GetIntrinsic = require('get-intrinsic'); |
|
|
|
var callBindBasic = require('call-bind-apply-helpers'); |
|
|
|
/** @type {(thisArg: string, searchString: string, position?: number) => number} */ |
|
var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]); |
|
|
|
/** @type {import('.')} */ |
|
module.exports = function callBoundIntrinsic(name, allowMissing) { |
|
/* eslint no-extra-parens: 0 */ |
|
|
|
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing)); |
|
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { |
|
return callBindBasic(/** @type {const} */ ([intrinsic])); |
|
} |
|
return intrinsic; |
|
};
|
|
|