lundi 24 juillet 2017

Detect if object is Ember Data or not

In Ember.js, I need to write a function that behaves differently depending on whether an object is an Ember Data object, or something else (Ember Object, plain JSON object, etc.). Is there a way to determine whether an object is Ember Data or not?

myfunction(myObject) {
    if(isEmberData(myObject)) {
        // Do stuff
    } else {
        // Do something else
    }
}




Aucun commentaire:

Enregistrer un commentaire