Skip to content

Instantly share code, notes, and snippets.

@adjohu
Created February 13, 2012 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adjohu/1817543 to your computer and use it in GitHub Desktop.
Save adjohu/1817543 to your computer and use it in GitHub Desktop.
var getOwnProperties = function(model){
var props = {};
for(var prop in model){
if( model.hasOwnProperty(prop)
&& prop.indexOf('__ember') < 0
&& prop.indexOf('_super') < 0
&& Ember.typeOf(model.get(prop)) !== 'function'
){
props[prop] = model[prop];
}
}
return props;
}
@algesten
Copy link

Another variant would be to slap on the getOwnProperties on the Ember.Object.prototype so all objects have it. http://jsfiddle.net/algesten/5Hj9E/

Now extra nice would be if we were to inspect functions and see if they have been marked .property()... that's the next level :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment