-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[WIP] [BUGFIX beta] Enable pushObject as a generic array method #15652
[WIP] [BUGFIX beta] Enable pushObject as a generic array method #15652
Conversation
@Serabe @locks @rwjblue @stefanpenner I'm not entirely sure if what I submitted here is the goal for #15501, but I thought I'd give it a shot. Let me know if this is a good starting point and headed in the right direction. Thanks in advance! 🍻 |
@@ -60,6 +60,10 @@ export function objectAt(content, idx) { | |||
return typeof content.objectAt === 'function' ? content.objectAt(idx) : content[idx]; | |||
} | |||
|
|||
export function pushObject(arr, obj) { | |||
return typeof arr.pushObject === 'function' ? arr.pushObject(obj) : arr.push(obj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should default to Array#push for this or if we should warn/error out here to let the developer know the prototype extension isn't on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to see this complete, pushObject
must be implemented off of arr
so that it can be used regardless of prototype extensions or not.
@@ -60,6 +60,10 @@ export function objectAt(content, idx) { | |||
return typeof content.objectAt === 'function' ? content.objectAt(idx) : content[idx]; | |||
} | |||
|
|||
export function pushObject(arr, obj) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was basing this on the work done here: 924bf0e - not sure if thats a good starting point. Let me know.
Hey everyone! Just curious what your thoughts are on the work here thus far? Thanks in advance. |
@@ -60,6 +60,10 @@ export function objectAt(content, idx) { | |||
return typeof content.objectAt === 'function' ? content.objectAt(idx) : content[idx]; | |||
} | |||
|
|||
export function pushObject(arr, obj) { | |||
return typeof arr.pushObject === 'function' ? arr.pushObject(obj) : arr.push(obj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to see this complete, pushObject
must be implemented off of arr
so that it can be used regardless of prototype extensions or not.
@alvincrespo ping |
1 similar comment
@alvincrespo ping |
@alvincrespo are you interested in finishing this work? |
Hope to you see you back some time! |
Tackles #15501
pushObject
task.Changes
pushObject
method inpackages/ember-runtime/lib/mixins/array.js
pushObject
packages/ember-extension-support/tests/data_adapter_test.js