Make harden() not have a prototype
MODIFY
packages/make-hardener/src/main.js
packages/make-hardener/src/main.js
@@ -63,10 +63,7 @@ function makeHardener(initialFringe, options = {}) {
const naivePrepareObject = options && options.naivePrepareObject;
- // We use the the concise method syntax to create a harden without a
- // [[Construct]] behavior (such that the invocation "new harden()" throws.
- const { harden } = {
- harden(root, registerOnly = false) {
+ const harden = { harden(root) {
const toFreeze = new Set();
const prototypes = new Map();
const paths = new WeakMap();
@@ -179,12 +176,7 @@ function makeHardener(initialFringe, options = {}) {
toFreeze.forEach(fringeSet.add, fringeSet);
}
- enqueue(root, 'root');
-
- if (registerOnly) {
- return;
- }
-
+ enqueue(root);
dequeue();
// console.log("fringeSet", fringeSet);
// console.log("prototype set:", prototypes);
@@ -193,8 +185,7 @@ function makeHardener(initialFringe, options = {}) {
commit();
return root;
- },
- };
+ }}.harden;
return harden;
}

Make harden() not have a prototype