removeProperties: initial framing
wrap register() with buildTable(), making minimal changes for benefit of
review. Look at this with 'git diff --ignore-space-change' to confirm that
the function is merely shifted, not modified.
MODIFY
src/removeProperties.js
src/removeProperties.js
// See the License for the specific language governing permissions and
// limitations under the License.
+const buildWhitelist = require('./whitelist.js').buildWhitelist;
- var hop = Object.prototype.hasOwnProperty;
-
- var getProto = Object.getPrototypeOf;
- var defProp = Object.defineProperty;
- var gopd = Object.getOwnPropertyDescriptor;
- var gopn = Object.getOwnPropertyNames;
- var keys = Object.keys;
- var freeze = Object.freeze;
- var create = Object.create;
-
+function removeProperties(global) {
+ // walk global object, test against whitelist, delete
+ const whitelist = buildWhitelist();
+ const uncurryThis = fn => (thisArg, ...args) => Reflect.apply(fn, thisArg, args);
+ const gopd = Object.getOwnPropertyDescriptor;
+ const gopn = Object.getOwnPropertyNames;
+ const keys = Object.keys;
+ const cleaning = new WeakMap();
+ const getProto = Object.getPrototype;
+ const hop = uncurryThis(Object.prototype.hasOwnProperty);
+ const whiteTable = new WeakMap();
+ function buildTable(global) {
/**
* The whiteTable should map from each path-accessible primordial
* object to the permit object that describes how it should be
});
}
register(sharedImports, whitelist);
+ }
/**
* Should the property named {@code name} be whitelisted on the

removeProperties: initial framing

wrap register() with buildTable(), making minimal changes for benefit of
review. Look at this with 'git diff --ignore-space-change' to confirm that
the function is merely shifted, not modified.