I was reading it again and seems like it's pretty shit.
It getOwnPropertyDescriptions, then map to entries Array<[ string, PropertyDescriptor ]>, then map again to Array< PropertyDescriptor & { name: string } >, filter only methods and reduce to an object.
I shoud use getOwnPropertyNames which gives me an Array<string> and reduce it, on reduce i can get PropertyDescriptor check if is method and merge to object.
Both Object.getOwnPropertyNames and Object.getOwnPropertyDescriptor have a good support, so don't need object.getownpropertydescriptors and object.entries polyfills.
I was reading it again and seems like it's pretty shit.
It getOwnPropertyDescriptions, then map to entries
Array<[ string, PropertyDescriptor ]>
, then map again toArray< PropertyDescriptor & { name: string } >
, filter only methods and reduce to an object.I shoud use getOwnPropertyNames which gives me an
Array<string>
and reduce it, on reduce i can get PropertyDescriptor check if is method and merge to object.Both
Object.getOwnPropertyNames
andObject.getOwnPropertyDescriptor
have a good support, so don't needobject.getownpropertydescriptors
andobject.entries
polyfills.