Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Object.is() method #513

Closed
HalidOdat opened this issue Jun 19, 2020 · 1 comment · Fixed by #515
Closed

Implement Object.is() method #513

HalidOdat opened this issue Jun 19, 2020 · 1 comment · Fixed by #515
Assignees
Labels
builtins PRs and Issues related to builtins/intrinsics E-Easy Easy enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@HalidOdat
Copy link
Member

ECMASCript feature
Implement the Object.is() method, the is method uses the SameValue algorithm (implementation is here)

The builtin Object functions are here, after implementing it should be added to Object here like defineProperty

Example code

Object.is('foo', 'foo');     // true

Object.is('foo', 'bar');     // false
Object.is([], []);           // false

var foo = { a: 1 };
var bar = { a: 1 };
Object.is(foo, foo);         // true
Object.is(foo, bar);         // false

Object.is(null, null);       // true

// Special Cases
Object.is(0, -0);            // false
Object.is(-0, -0);           // true
Object.is(NaN, 0/0);         // true

More information:

@HalidOdat HalidOdat added enhancement New feature or request good first issue Good for newcomers E-Easy Easy builtins PRs and Issues related to builtins/intrinsics labels Jun 19, 2020
@tylermorten
Copy link

I could probably tackle this one. Do we need it to work in “strict” mode as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics E-Easy Easy enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants