[rpclibrary](../README.md) › [Globals](../globals.md) › ["Utils"](_utils_.md) # External module: "Utils" ## Index ### Functions * [extractArgs](_utils_.md#const-extractargs) * [hookGenerator](_utils_.md#const-hookgenerator) * [makeSubResponse](_utils_.md#makesubresponse) * [rpcHooker](_utils_.md#rpchooker) * [rpcToRpcinfo](_utils_.md#const-rpctorpcinfo) ## Functions ### `Const` extractArgs ▸ **extractArgs**(`f`: Function): *T.Arg[]* Defined in Utils.ts:110 Extract a string list of parameters from a function **Parameters:** Name | Type | Description | ------ | ------ | ------ | `f` | Function | The source function | **Returns:** *T.Arg[]* ___ ### `Const` hookGenerator ▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function* Defined in Utils.ts:85 Utility function to generate [HookFunction](_types_.md#hookfunction) from a RPC **Parameters:** Name | Type | Description | ------ | ------ | ------ | `rpc` | T.HookRPC‹any› | The RPC to transform | **Returns:** *function* A [HookFunction](_types_.md#hookfunction) ▸ (`socket?`: I.Socket): *[HookFunction](_types_.md#hookfunction)‹T›* **Parameters:** Name | Type | ------ | ------ | `socket?` | I.Socket | ___ ### makeSubResponse ▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)* Defined in Utils.ts:119 Simple utility function to create basic [SubscriptionResponse](_types_.md#subscriptionresponse) **Parameters:** Name | Type | Description | ------ | ------ | ------ | `uuid?` | undefined | string | optional uuid to use, otherwise defaults to uuid/v4 | **Returns:** *[SubscriptionResponse](_types_.md#subscriptionresponse)* ___ ### rpcHooker ▸ **rpcHooker**<**SubResT**>(`socket`: [Socket](../interfaces/_interfaces_.socket.md), `exporter`: [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResT›, `makeUnique`: boolean): *T.ExtendedRpcInfo[]* Defined in Utils.ts:59 Utility function to apply the RPCs of an [RPCExporter](../interfaces/_interfaces_.rpcexporter.md). **Type parameters:** ▪ **SubResT** **Parameters:** Name | Type | Default | Description | ------ | ------ | ------ | ------ | `socket` | [Socket](../interfaces/_interfaces_.socket.md) | - | The websocket (implementation: bsock) to hook on | `exporter` | [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResT› | - | The exporter | `makeUnique` | boolean | true | @default true Attach a suffix to RPC names | **Returns:** *T.ExtendedRpcInfo[]* ___ ### `Const` rpcToRpcinfo ▸ **rpcToRpcinfo**<**SubResT**>(`rpc`: T.RPC‹SubResT›, `owner`: T.Owner): *T.RpcInfo* Defined in Utils.ts:13 Translate an RPC to RPCInfo for serialization. **Type parameters:** ▪ **SubResT** **Parameters:** Name | Type | Description | ------ | ------ | ------ | `rpc` | T.RPC‹SubResT› | The RPC to transform | `owner` | T.Owner | The owning RPC group's name | **Returns:** *T.RpcInfo*