tiptap/packages/core/src/utils/getAllMethodNames.ts

11 lines
244 B
TypeScript
Raw Normal View History

2020-03-30 02:36:57 +08:00
export default function getAllMethodNames(obj: Object) {
2020-09-24 06:29:05 +08:00
const methods = new Set()
2020-03-30 02:36:57 +08:00
while (obj = Reflect.getPrototypeOf(obj)) {
2020-09-24 06:29:05 +08:00
const keys = Reflect.ownKeys(obj)
keys.forEach(k => methods.add(k))
2020-03-30 02:36:57 +08:00
}
return Array.from(methods)
2020-09-24 06:29:05 +08:00
}