diff --git a/docs/modules/_utils_.md b/docs/modules/_utils_.md index 4543b68..f9137c2 100644 --- a/docs/modules/_utils_.md +++ b/docs/modules/_utils_.md @@ -18,7 +18,7 @@ ▸ **extractArgs**(`f`: Function): *T.Arg[]* -Defined in Utils.ts:91 +Defined in Utils.ts:96 **Parameters:** @@ -34,7 +34,7 @@ ___ ▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function* -Defined in Utils.ts:70 +Defined in Utils.ts:75 **Parameters:** @@ -58,7 +58,7 @@ ___ ▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)* -Defined in Utils.ts:96 +Defined in Utils.ts:101 **Parameters:** @@ -74,7 +74,7 @@ ___ ▸ **rpcHooker**<**SubResT**>(`socket`: [Socket](../interfaces/_interfaces_.socket.md), `exporter`: [Exporter](../interfaces/_interfaces_.exporter.md)‹SubResT›, `makeUnique`: boolean): *T.ExtendedRpcInfo[]* -Defined in Utils.ts:48 +Defined in Utils.ts:53 **Type parameters:** @@ -96,7 +96,9 @@ ___ ▸ **rpcToRpcinfo**<**SubResT**>(`rpc`: T.RPC‹SubResT›, `owner`: T.Owner): *T.RpcInfo* -Defined in Utils.ts:8 +Defined in Utils.ts:13 + +Translate an RPC to RPCInfo for serialization. **Type parameters:** @@ -104,9 +106,9 @@ Defined in Utils.ts:8 **Parameters:** -Name | Type | ------- | ------ | -`rpc` | T.RPC‹SubResT› | -`owner` | T.Owner | +Name | Type | Description | +------ | ------ | ------ | +`rpc` | T.RPC‹SubResT› | The RPC to transform | +`owner` | T.Owner | The owning RPC group's name | **Returns:** *T.RpcInfo* diff --git a/src/Utils.ts b/src/Utils.ts index d2cbf8f..0ac9614 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -4,7 +4,12 @@ import * as T from "./Types"; import * as I from "./Interfaces"; import { SubscriptionResponse } from "./Types"; - +/** + * Translate an RPC to RPCInfo for serialization. + * @param rpc The RPC to transform + * @param owner The owning RPC group's name + * @throws Error on RPC without name property + */ export const rpcToRpcinfo = (rpc : T.RPC, owner: T.Owner):T.RpcInfo => { switch (typeof rpc){ case "object":