summaryrefslogtreecommitdiff
path: root/js/util.ts
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2019-04-19 17:39:54 -0700
committerRyan Dahl <ry@tinyclouds.org>2019-04-19 20:39:54 -0400
commitc8db224efed08d7722c9951cde048d731db050d3 (patch)
treeb492275744af8dfae9977ef8309925e725daba09 /js/util.ts
parent0796a8f2f75005df95ef6115a4bdf6dd66e58dc3 (diff)
Make Deno/Deno.core not deletable/writable (#2153)
Diffstat (limited to 'js/util.ts')
-rw-r--r--js/util.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/js/util.ts b/js/util.ts
index b81b96aca..348e36a1f 100644
--- a/js/util.ts
+++ b/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,