mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
Make Deno/Deno.core not deletable/writable (#2153)
This commit is contained in:
parent
0796a8f2f7
commit
c8db224efe
4 changed files with 67 additions and 2 deletions
15
js/util.ts
15
js/util.ts
|
@ -131,6 +131,21 @@ export function requiredArguments(
|
|||
}
|
||||
}
|
||||
|
||||
// @internal
|
||||
export function immutableDefine(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
o: any,
|
||||
p: string | number | symbol,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
value: any
|
||||
): void {
|
||||
Object.defineProperty(o, p, {
|
||||
value,
|
||||
configurable: false,
|
||||
writable: false
|
||||
});
|
||||
}
|
||||
|
||||
// Returns values from a WeakMap to emulate private properties in JavaScript
|
||||
export function getPrivateValue<
|
||||
K extends object,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue