Replace any in favour of some to align with regular JS#233
Replace any in favour of some to align with regular JS#233cibernox wants to merge 2 commits intoemberjs:masterfrom
any in favour of some to align with regular JS#233Conversation
any in favour of someany in favour of some to align with regular JS
|
@alexspeller You might have something to say as this is almost a copy of another RFC you made, with the exception that we don't have to polyfill this feature since it is available even in IE9. |
|
Definitely in favour, and also in favour of renaming isAny to isSome for consistency. I think the small amount of very easily updatable churn is worth it to keep more in line with standards. |
|
|
||
| # Detailed design | ||
|
|
||
| The first step is to rename `any` to `some` and recreate `any` as simply an alias |
There was a problem hiding this comment.
s/alias/deprecatingAlias/
https://emberjs.com/api/classes/Ember.computed.html#method_deprecatingAlias
There was a problem hiding this comment.
I wanted to leave the deprecation part optional, that is why I mentioned the deprecation as a separate step. In case we decide to implemente and deprecate, deprecatingAlias is indeed how I'd implement this.
|
One quick comment on this. Though documentation still says otherwise, let arr = emberA([undefined, null, false, 5]);
let result = arr.any(o => o);
assert.equal(result, 5);Can you change the RFC to accomodate to {
some(...args) {
return !!this.any(...args);
}
}And there might be people out there relying on the fact that Thank you! |
|
To build on top of @Serabe's latest comment, I don't think this should be framed as aliasing, given that the two methods have slightly different semantics in practice. |
|
With Octane shipped, we are no longer looking to make changes to this part of the framework. Thanks to all involved for your effort! |
|
This is because any only exists on ember array, yeah? |
Rendered