Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const {
ObjectGetOwnPropertyDescriptors,
ObjectGetPrototypeOf,
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ObjectSetPrototypeOf,
ObjectValues,
Promise,
Expand Down Expand Up @@ -354,26 +353,6 @@ function cachedResult(fn) {
};
}

// Useful for Wrapping an ES6 Class with a constructor Function that
// does not require the new keyword. For instance:
// class A { constructor(x) {this.x = x;}}
// const B = createClassWrapper(A);
// B() instanceof A // true
// B() instanceof B // true
function createClassWrapper(type) {
function fn(...args) {
return ReflectConstruct(type, args, new.target || type);
}
// Mask the wrapper function name and length values
ObjectDefineProperties(fn, {
name: { __proto__: null, value: type.name },
length: { __proto__: null, value: type.length },
});
ObjectSetPrototypeOf(fn, type);
fn.prototype = type.prototype;
return fn;
}

let signalsToNamesMapping;
function getSignalsToNamesMapping() {
if (signalsToNamesMapping !== undefined)
Expand Down Expand Up @@ -649,16 +628,6 @@ function exposeNamespace(target, name, namespaceObject) {
});
}

function exposeGetterAndSetter(target, name, getter, setter = undefined) {
ObjectDefineProperty(target, name, {
__proto__: null,
enumerable: false,
configurable: true,
get: getter,
set: setter,
});
}

function defineReplaceableLazyAttribute(target, id, keys, writable = true, check) {
let mod;
for (let i = 0; i < keys.length; i++) {
Expand Down Expand Up @@ -732,18 +701,6 @@ ObjectFreeze(kEnumerableProperty);

const kEmptyObject = ObjectFreeze({ __proto__: null });

function filterOwnProperties(source, keys) {
const filtered = { __proto__: null };
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (ObjectPrototypeHasOwnProperty(source, key)) {
filtered[key] = source[key];
}
}

return filtered;
}

/**
* Mimics `obj[key] = value` but ignoring potential prototype inheritance.
* @param {any} obj
Expand Down Expand Up @@ -976,7 +933,6 @@ module.exports = {
constructSharedArrayBuffer,
convertProcessSignalToExitCode,
convertToValidSignal,
createClassWrapper,
decorateErrorStack,
defineOperation,
defineLazyProperties,
Expand All @@ -989,13 +945,10 @@ module.exports = {
exposeInterface,
exposeLazyInterfaces,
exposeNamespace,
exposeGetterAndSetter,
filterDuplicateStrings,
filterOwnProperties,
getConstructorOf,
getCIDR,
getCWDURL,
getInternalGlobal,
getStructuredStack,
getSystemErrorMap,
getSystemErrorName,
Expand Down
31 changes: 0 additions & 31 deletions test/parallel/test-internal-util-classwrapper.js

This file was deleted.

Loading