Last active
August 29, 2015 14:08
-
-
Save AaronGhent/12f5d8ab844c1bed0949 to your computer and use it in GitHub Desktop.
Ember.NativeObjectMixin - Converts Ember Objects into Native JavaScript Objects
This file contains 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
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