UNPKG

@powership/server

Version:
1 lines 913 B
{"version":3,"file":"createHandler.cjs","names":["createHandler","name","hooks","data"],"sources":["../src/createHandler.ts"],"sourcesContent":["/*\n * Creates a Server request/response handler\n * See Server tests for more examples\n */\nimport type { Handler, ServerHooksRecord } from './Server';\n\nexport function createHandler<Data extends Record<string, any>>(\n name: string,\n hooks: ServerHooksRecord,\n data: Data\n): Handler<Data>;\n\nexport function createHandler(\n name: string,\n hooks: ServerHooksRecord\n): Handler<undefined>;\n\nexport function createHandler(\n name: string,\n hooks: ServerHooksRecord,\n data?: any\n) {\n return {\n name,\n hooks,\n data: data || {},\n };\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;;AAcO,SAASA,aAAaA,CAC3BC,IAAY,EACZC,KAAwB,EACxBC,IAAU,EACV;EACA,OAAO;IACLF,IAAI;IACJC,KAAK;IACLC,IAAI,EAAEA,IAAI,IAAI,CAAC;EACjB,CAAC;AACH","ignoreList":[]}