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
const getAllClassMethods = (obj) => { | |
let keys = [] | |
let topObject = obj | |
const onlyOriginalMethods = (p, i, arr) => | |
typeof topObject[p] === 'function' && // only the methods | |
p !== 'constructor' && // not the constructor | |
(i === 0 || p !== arr[i - 1]) && // not overriding in this prototype | |
keys.indexOf(p) === -1 // not overridden in a child |