ember-cp-validations
Version:
Ember computed property based validation library
23 lines (18 loc) • 492 B
JavaScript
/**
* Checks if the give key exists on the object's super.
* If so, we can successfully call the obj[key] _super
*
* Created by @rwjblue
*/
export default function shouldCallSuper(obj, key) {
let current = Object.getPrototypeOf(obj);
current = Object.getPrototypeOf(current);
while (current) {
let descriptor = Object.getOwnPropertyDescriptor(current, key);
if (descriptor) {
return true;
}
current = Object.getPrototypeOf(current);
}
return false;
}