From c4ae27160439031a8035fc1c5f5d2f8e7da08e27 Mon Sep 17 00:00:00 2001 From: Jerko Steiner Date: Thu, 5 Sep 2019 09:28:48 +0700 Subject: [PATCH] Move private _-prefix method check into getAllMethods --- packages/jsonrpc/src/jsonrpc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jsonrpc/src/jsonrpc.ts b/packages/jsonrpc/src/jsonrpc.ts index 7c80c7f..a685760 100644 --- a/packages/jsonrpc/src/jsonrpc.ts +++ b/packages/jsonrpc/src/jsonrpc.ts @@ -51,6 +51,7 @@ export function getAllMethods(obj: T): Array> { const l = Object.getOwnPropertyNames(obj) .filter((p, i, arr) => { return typeof (obj as any)[p] === 'function' && + p.startsWith('_') === false && p !== 'constructor' }) .forEach(p => props.add(p)) @@ -144,7 +145,6 @@ export const createRpcService = >( const isNotification = req.id === null || req.id === undefined if ( - method.startsWith('_') || !rpcService.hasOwnProperty(method) || typeof rpcService[method] !== 'function' ) {