From e14bef696d246bb382f230ea64de03f8d8fcbdef Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Sat, 30 Dec 2023 15:50:27 +0100 Subject: [PATCH] chore: move copy-prototype-methods up one level --- lib/{prototypes => }/copy-prototype-methods.mjs | 5 +++-- lib/{prototypes => }/copy-prototype-methods.test.mjs | 0 lib/prototypes/array.mjs | 2 +- lib/prototypes/function.mjs | 2 +- lib/prototypes/map.mjs | 2 +- lib/prototypes/object.mjs | 2 +- lib/prototypes/set.mjs | 2 +- lib/prototypes/string.mjs | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) rename lib/{prototypes => }/copy-prototype-methods.mjs (93%) rename lib/{prototypes => }/copy-prototype-methods.test.mjs (100%) diff --git a/lib/prototypes/copy-prototype-methods.mjs b/lib/copy-prototype-methods.mjs similarity index 93% rename from lib/prototypes/copy-prototype-methods.mjs rename to lib/copy-prototype-methods.mjs index a07d4b0..a2e038f 100644 --- a/lib/prototypes/copy-prototype-methods.mjs +++ b/lib/copy-prototype-methods.mjs @@ -1,5 +1,4 @@ -import throwsOnProto from "../throws-on-proto.mjs"; -var call = Function.call; +import throwsOnProto from "./throws-on-proto.mjs"; var disallowedProperties = [ // ignore size because it throws from Map @@ -22,6 +21,8 @@ if (throwsOnProto) { * @returns {object} A new object that has the same methods of the prototype */ function copyPrototypeMethods(prototype) { + const call = Function.call; + // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods return Object.getOwnPropertyNames(prototype).reduce(function ( result, diff --git a/lib/prototypes/copy-prototype-methods.test.mjs b/lib/copy-prototype-methods.test.mjs similarity index 100% rename from lib/prototypes/copy-prototype-methods.test.mjs rename to lib/copy-prototype-methods.test.mjs diff --git a/lib/prototypes/array.mjs b/lib/prototypes/array.mjs index 64990c8..ccbe500 100644 --- a/lib/prototypes/array.mjs +++ b/lib/prototypes/array.mjs @@ -1,3 +1,3 @@ -import copyPrototype from "./copy-prototype-methods.mjs"; +import copyPrototype from "../copy-prototype-methods.mjs"; export default copyPrototype(Array.prototype); diff --git a/lib/prototypes/function.mjs b/lib/prototypes/function.mjs index b843c75..897a6ff 100644 --- a/lib/prototypes/function.mjs +++ b/lib/prototypes/function.mjs @@ -1,3 +1,3 @@ -import copyPrototype from "./copy-prototype-methods.mjs"; +import copyPrototype from "../copy-prototype-methods.mjs"; export default copyPrototype(Function.prototype); diff --git a/lib/prototypes/map.mjs b/lib/prototypes/map.mjs index 1bf079b..e3d0781 100644 --- a/lib/prototypes/map.mjs +++ b/lib/prototypes/map.mjs @@ -1,3 +1,3 @@ -import copyPrototype from "./copy-prototype-methods.mjs"; +import copyPrototype from "../copy-prototype-methods.mjs"; export default copyPrototype(Map.prototype); diff --git a/lib/prototypes/object.mjs b/lib/prototypes/object.mjs index e3333b2..5dc4d7b 100644 --- a/lib/prototypes/object.mjs +++ b/lib/prototypes/object.mjs @@ -1,3 +1,3 @@ -import copyPrototype from "./copy-prototype-methods.mjs"; +import copyPrototype from "../copy-prototype-methods.mjs"; export default copyPrototype(Object.prototype); diff --git a/lib/prototypes/set.mjs b/lib/prototypes/set.mjs index b52f9e3..ec6f658 100644 --- a/lib/prototypes/set.mjs +++ b/lib/prototypes/set.mjs @@ -1,3 +1,3 @@ -import copyPrototype from "./copy-prototype-methods.mjs"; +import copyPrototype from "../copy-prototype-methods.mjs"; export default copyPrototype(Set.prototype); diff --git a/lib/prototypes/string.mjs b/lib/prototypes/string.mjs index faa2b4d..8598723 100644 --- a/lib/prototypes/string.mjs +++ b/lib/prototypes/string.mjs @@ -1,3 +1,3 @@ -import copyPrototype from "./copy-prototype-methods.mjs"; +import copyPrototype from "../copy-prototype-methods.mjs"; export default copyPrototype(String.prototype);