Skip to content

Instantly share code, notes, and snippets.

@AaronGhent
Last active August 29, 2015 14:08
Show Gist options
  • Save AaronGhent/12f5d8ab844c1bed0949 to your computer and use it in GitHub Desktop.
Save AaronGhent/12f5d8ab844c1bed0949 to your computer and use it in GitHub Desktop.
Ember.NativeObjectMixin - Converts Ember Objects into Native JavaScript Objects
import Ember from 'ember';
var NativeObjectMixin = Ember.Mixin.create({
toNative: function() {
var properties = [];
for (var key in this) {
var types = ['string', 'number', 'boolean'];
if (types.contains(Ember.typeOf(this[key]))) {
properties.push(key);
}
}
return this.getProperties(properties);
}
});
export default NativeObjectMixin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment