react
react copied to clipboard
compiler: add built-in Object.prototype methods to ShapeRegistry
This PR enhances the ShapeRegistry
by incorporating additional Object.prototype methods from the TODO.
In this implementation:
-
toLocaleString
is similar to the existingtoString
method: it takes no arguments and returns a primitive value (string). -
hasOwnProperty
,isPrototypeOf
, andpropertyIsEnumerable
all take one argument and return a primitive (boolean). -
valueOf
takes no arguments and returns a poly type(thethis
value, converted to an object.).
References:
- toLocaleString: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toLocaleString
- hasOwnProperty: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
- isPrototypeOf: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf
- propertyIsEnumerable: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable
- valueOf: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf