mirror of
https://github.com/sern-handler/website
synced 2026-06-27 18:22:22 +00:00
feat: migrate to starlight
This commit is contained in:
39
node_modules/unified/lib/callable-instance.js
generated
vendored
Normal file
39
node_modules/unified/lib/callable-instance.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
export const CallableInstance =
|
||||
/**
|
||||
* @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}
|
||||
*/
|
||||
(
|
||||
/** @type {unknown} */
|
||||
(
|
||||
/**
|
||||
* @this {Function}
|
||||
* @param {string | symbol} property
|
||||
* @returns {(...parameters: Array<unknown>) => unknown}
|
||||
*/
|
||||
function (property) {
|
||||
const self = this
|
||||
const constr = self.constructor
|
||||
const proto = /** @type {Record<string | symbol, Function>} */ (
|
||||
// Prototypes do exist.
|
||||
// type-coverage:ignore-next-line
|
||||
constr.prototype
|
||||
)
|
||||
const func = proto[property]
|
||||
/** @type {(...parameters: Array<unknown>) => unknown} */
|
||||
const apply = function () {
|
||||
return func.apply(apply, arguments)
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(apply, proto)
|
||||
|
||||
const names = Object.getOwnPropertyNames(func)
|
||||
|
||||
for (const p of names) {
|
||||
const descriptor = Object.getOwnPropertyDescriptor(func, p)
|
||||
if (descriptor) Object.defineProperty(apply, p, descriptor)
|
||||
}
|
||||
|
||||
return apply
|
||||
}
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user