Move private _-prefix method check into getAllMethods
This commit is contained in:
parent
1aa6cae0f3
commit
c4ae271604
@ -51,6 +51,7 @@ export function getAllMethods<T>(obj: T): Array<FunctionPropertyNames<T>> {
|
|||||||
const l = Object.getOwnPropertyNames(obj)
|
const l = Object.getOwnPropertyNames(obj)
|
||||||
.filter((p, i, arr) => {
|
.filter((p, i, arr) => {
|
||||||
return typeof (obj as any)[p] === 'function' &&
|
return typeof (obj as any)[p] === 'function' &&
|
||||||
|
p.startsWith('_') === false &&
|
||||||
p !== 'constructor'
|
p !== 'constructor'
|
||||||
})
|
})
|
||||||
.forEach(p => props.add(p))
|
.forEach(p => props.add(p))
|
||||||
@ -144,7 +145,6 @@ export const createRpcService = <T, M extends FunctionPropertyNames<T>>(
|
|||||||
const isNotification = req.id === null || req.id === undefined
|
const isNotification = req.id === null || req.id === undefined
|
||||||
|
|
||||||
if (
|
if (
|
||||||
method.startsWith('_') ||
|
|
||||||
!rpcService.hasOwnProperty(method) ||
|
!rpcService.hasOwnProperty(method) ||
|
||||||
typeof rpcService[method] !== 'function'
|
typeof rpcService[method] !== 'function'
|
||||||
) {
|
) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user