Skip to content

Commit

Permalink
Update to use Object#isPrototypeOf
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Nov 8, 2021
1 parent 361028c commit 88bf340
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Float16Array.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
ArrayPrototypeJoin,
ArrayPrototypePush,
ArrayPrototypeToLocaleString,
FunctionPrototypeSymbolHasInstance,
NativeArrayBuffer,
NativeObject,
NativeProxy,
Expand All @@ -42,6 +41,7 @@ import {
ObjectDefineProperty,
ObjectFreeze,
ObjectHasOwn,
ObjectPrototypeIsPrototypeOf,
ReflectApply,
ReflectConstruct,
ReflectDefineProperty,
Expand Down Expand Up @@ -245,7 +245,7 @@ const handler = ObjectFreeze(/** @type {ProxyHandler<Float16Array>} */ ({
// %TypedArray%.prototype getter properties cannot called by Proxy receiver
if (
SetPrototypeHas(TypedArrayPrototypeGetterKeys, key) &&
FunctionPrototypeSymbolHasInstance(TypedArray, target)
ObjectPrototypeIsPrototypeOf(TypedArrayPrototype, target)
) {
return ReflectGet(target, key);
}
Expand Down
10 changes: 3 additions & 7 deletions src/_util/primordials.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ export const {
toStringTag: SymbolToStringTag,
for: SymbolFor,
} = NativeSymbol;
const SymbolHasInstance = NativeSymbol.hasInstance;

// Function
export const FunctionPrototypeSymbolHasInstance = uncurryThis(
Function.prototype[SymbolHasInstance]
);

// Object
export const NativeObject = Object;
Expand All @@ -65,9 +59,11 @@ export const {
freeze: ObjectFreeze,
is: ObjectIs,
} = NativeObject;
const ObjectPrototype = NativeObject.prototype;
export const ObjectPrototypeIsPrototypeOf = uncurryThis(ObjectPrototype.isPrototypeOf);
/** @type {(object: object, key: PropertyKey) => boolean} */
export const ObjectHasOwn = /** @type {any} */ (NativeObject).hasOwn ||
uncurryThis(NativeObject.prototype.hasOwnProperty);
uncurryThis(ObjectPrototype.hasOwnProperty);

// Array
const NativeArray = Array;
Expand Down

0 comments on commit 88bf340

Please sign in to comment.