vcapi-workers / Exports / middleware/remapping
Module: middleware/remapping
インデックスとリストアイテムのIDを変換するミドルウェア
Table of contents
Type Aliases
Functions
Type Aliases
RemapIndexMiddlewareOptions
Ƭ RemapIndexMiddlewareOptions: Object
Type declaration
| Name | Type |
|---|---|
getMapping | (obj: JSONObject) => number[] | undefined |
mappingKey | (c: Context) => string |
Defined in
src/middleware/remapping.ts:11 (opens in a new tab)
Functions
remap
▸ remap(c, mappingKey, index): number
セッションのデータをもとに、変換したIDを返す
Parameters
| Name | Type |
|---|---|
c | Context |
mappingKey | string |
index | number |
Returns
number
Defined in
src/middleware/remapping.ts:17 (opens in a new tab)
remapIndex
▸ remapIndex(options): MiddlewareHandler
クライアント側で過剰に長いURL配列を作らなくていいように、 レスポンスのJSONに含まれるリストのインデックスとリストアイテムのIDを変換するミドルウェア
Parameters
| Name | Type |
|---|---|
options | RemapIndexMiddlewareOptions |
Returns
MiddlewareHandler