module@warp-drive/legacy/compat/utils @legacy
Function formattedId()
Call Signature
ts
function formattedId(id): string;Defined in: warp-drive-packages/legacy/src/compat/utils.ts:144
Format an id to the format expected by the WarpDrive Cache. Currently this means that id should be string | null.
Asserts invalid IDs (undefined, '', 0, '0') in dev.
Usage
js
import formattedId from 'client/utils/formatted-id';
formattedId('1'); // => '1'
formattedId(1); // => '1'
formattedId(null); // => null
```
### Parameters
#### id
`string` \| `number`
the potentially un-normalized id
### Returns
`string`
the normalized id
## Call Signature
```ts
function formattedId(id): null;Defined in: warp-drive-packages/legacy/src/compat/utils.ts:145
Format an id to the format expected by the WarpDrive Cache. Currently this means that id should be string | null.
Asserts invalid IDs (undefined, '', 0, '0') in dev.
Usage
js
import formattedId from 'client/utils/formatted-id';
formattedId('1'); // => '1'
formattedId(1); // => '1'
formattedId(null); // => null
```
### Parameters
#### id
`null`
the potentially un-normalized id
### Returns
`null`
the normalized id
## Call Signature
```ts
function formattedId(id): string | null;Defined in: warp-drive-packages/legacy/src/compat/utils.ts:146
Format an id to the format expected by the WarpDrive Cache. Currently this means that id should be string | null.
Asserts invalid IDs (undefined, '', 0, '0') in dev.
Usage
js
import formattedId from 'client/utils/formatted-id';
formattedId('1'); // => '1'
formattedId(1); // => '1'
formattedId(null); // => null
```
### Parameters
#### id
`string` \| `number` \| `null`
the potentially un-normalized id
### Returns
`string` \| `null`
the normalized id