Repository navigation
fix: handle missing Object.prototype methods in @stdlib/assert - #16808
ItsAbir005 wants to merge 13 commits into
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
Object.prototype methods in @stdlib/assert
…ndle CLI test" This reverts commit 3ce0d88.
|
For the record, I bundled this PR's head ( Why the polyfill throwing on primitives in MicroQuickJS isn't a problemOn MicroQuickJS, the polyfill throws when given a primitive receiver (e.g., And on engines that implement ES5 in full, |
Thanks @batpigandme for verifying on MicroQuickJS and lv5! @kgryte All requested changes have been addressed (using standard barrel file architecture and proxyquire). Could you take another look when you have a moment? |
batpigandme
left a comment
There was a problem hiding this comment.
Thanks for the updates! The barrel file and the proxyquire tests now follow string/base/trim closely. The line comments bring polyfill.js in line with how sibling packages handle the same things:
- Requiring
@stdlib/object/ctorand cachingObject.keys, as other packages that can't depend on@stdlib/utils/keysdo, rather than disabling two lint rules for the whole file. String( property )rather than'' + property.
With them applied, polyfill.js lints cleanly with no disable comments, and test.polyfill.js still passes.
|
Changes look god, @ItsAbir005. We'll wait on @kgryte to approve and merge when he gets a chance. 👍 |
Thanks @batpigandme for review & suggestions. Can you review #16920 I recently open fix doc typos |
Resolves #16798.
Description
This pull request:
Object.prototype.propertyIsEnumerablein@stdlib/assert/is-enumerable-propertyusingObject.keyswhen the built-in is unavailable or not a function, while retaining the module-scope cache inlib/native.js.@stdlib/assert/is-plain-objectto testproto === objectPrototype(same-realm check) first, requiring an ownisPrototypeOfmethod only on the cross-realm fallback branch.propertyIsEnumerableandisPrototypeOfare deleted fromObject.prototype(and safely restored usingObject.defineProperty).@stdlib/math/strided/ops/*and dependent assertion utilities on minimal JavaScript engines that omit these prototype methods (such as MicroQuickJS).Related Issues
This pull request has the following related issues:
propertyIsEnumerableorisPrototypeOf#16798Reference Packages
This pull request followed these packages:
process/getuidnative.js,polyfill.js, andmain.js, as well as standard symbol-support test skip guards (hasSymbolSupport).Object.keys-based polyfill forpropertyIsEnumerable, documenting symbol omission notes, and the same-realm prototype reordering inis-plain-object.Questions
No.
Other
Object.defineProperty(withenumerable: false) and explicitly assert thatfor ( k in {} )produces zero enumerable keys.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was developed with assistance from Gemini for research, code implementation, and test generation, followed by manual verification, test runs, and lint validation in GitHub Codespaces.
@stdlib-js/reviewers