Well, this proposal is not for check equality. Its purpose is to compare two object that which object is `greater`.
I'm sure this feature is already implemented for every modern js engines, as it's needed to implement Map/Set. But we don't have js interface for it yet. Thus proposal is to expose this functionality to userland application. 2016. 9. 19. 오후 2:26에 "Jordan Harband" <[email protected]>님이 작성: > This may have already been proposed as https://github.com/ > sebmarkbage/ecmascript-shallow-equal - if so, you'll want to post your > comments there. > > On Sun, Sep 18, 2016 at 10:10 PM, Park Hyeonu <[email protected]> wrote: > >> tl;dr - deterministic function that compares arbitrary objects >> >> I know now we have `Map` and `Set`, but sometimes we need more low level >> ones. Especially for library developers. >> >> For the case, say, I want to implement a map whose key can be a arbitrary >> number of objects. Currently this can only implemented as nested map whose >> structure is `keylen -> key1 -> key2 -> ... -> value`. Not really elegant. >> But if we have `Object.compare()`, `(key1, key2, ...) -> value` is possible. >> >> As its intended purpose is to be used with custom map/set, I don't think >> we should define how this function works in spec. Just guaranteed to be >> deterministic in each runtime is enough. >> >> For detail, this function follows `(left: any, right: any) => number` >> form. When `Object.is(left, right)` is true, `Object.compare(left, right)` >> must return `0`. Otherwise, the result must be deterministic, means >> whenever(in same runtime) we call this function with same arguments it >> should return same value(or at least, always greater than/lesser 0). >> >> Seems good? >> >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> >> >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

