Created
February 13, 2012 15:18
-
-
Save adjohu/1817543 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another variant would be to slap on the
getOwnPropertieson theEmber.Object.prototypeso 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 :)