Skip to content

Commit 3c8e709

Browse files
committed
util: remove unused functions
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 8d0a3b8 commit 3c8e709

2 files changed

Lines changed: 0 additions & 77 deletions

File tree

lib/internal/util.js

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -354,26 +354,6 @@ function cachedResult(fn) {
354354
};
355355
}
356356

357-
// Useful for Wrapping an ES6 Class with a constructor Function that
358-
// does not require the new keyword. For instance:
359-
// class A { constructor(x) {this.x = x;}}
360-
// const B = createClassWrapper(A);
361-
// B() instanceof A // true
362-
// B() instanceof B // true
363-
function createClassWrapper(type) {
364-
function fn(...args) {
365-
return ReflectConstruct(type, args, new.target || type);
366-
}
367-
// Mask the wrapper function name and length values
368-
ObjectDefineProperties(fn, {
369-
name: { __proto__: null, value: type.name },
370-
length: { __proto__: null, value: type.length },
371-
});
372-
ObjectSetPrototypeOf(fn, type);
373-
fn.prototype = type.prototype;
374-
return fn;
375-
}
376-
377357
let signalsToNamesMapping;
378358
function getSignalsToNamesMapping() {
379359
if (signalsToNamesMapping !== undefined)
@@ -649,16 +629,6 @@ function exposeNamespace(target, name, namespaceObject) {
649629
});
650630
}
651631

652-
function exposeGetterAndSetter(target, name, getter, setter = undefined) {
653-
ObjectDefineProperty(target, name, {
654-
__proto__: null,
655-
enumerable: false,
656-
configurable: true,
657-
get: getter,
658-
set: setter,
659-
});
660-
}
661-
662632
function defineReplaceableLazyAttribute(target, id, keys, writable = true, check) {
663633
let mod;
664634
for (let i = 0; i < keys.length; i++) {
@@ -732,18 +702,6 @@ ObjectFreeze(kEnumerableProperty);
732702

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

735-
function filterOwnProperties(source, keys) {
736-
const filtered = { __proto__: null };
737-
for (let i = 0; i < keys.length; i++) {
738-
const key = keys[i];
739-
if (ObjectPrototypeHasOwnProperty(source, key)) {
740-
filtered[key] = source[key];
741-
}
742-
}
743-
744-
return filtered;
745-
}
746-
747705
/**
748706
* Mimics `obj[key] = value` but ignoring potential prototype inheritance.
749707
* @param {any} obj
@@ -976,7 +934,6 @@ module.exports = {
976934
constructSharedArrayBuffer,
977935
convertProcessSignalToExitCode,
978936
convertToValidSignal,
979-
createClassWrapper,
980937
decorateErrorStack,
981938
defineOperation,
982939
defineLazyProperties,
@@ -989,13 +946,10 @@ module.exports = {
989946
exposeInterface,
990947
exposeLazyInterfaces,
991948
exposeNamespace,
992-
exposeGetterAndSetter,
993949
filterDuplicateStrings,
994-
filterOwnProperties,
995950
getConstructorOf,
996951
getCIDR,
997952
getCWDURL,
998-
getInternalGlobal,
999953
getStructuredStack,
1000954
getSystemErrorMap,
1001955
getSystemErrorName,

test/parallel/test-internal-util-classwrapper.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)