(object: T, fn: (key: string) => string)
| 23 | export const isEmptyObj = (obj: Record<string, any>): boolean => Object.keys(obj).length <= 0 |
| 24 | |
| 25 | export function convertKeys<T extends Record<string, unknown>>(object: T, fn: (key: string) => string): T { |
| 26 | return Object.keys(object).reduce((acc, key) => { |
| 27 | acc[fn(key)] = object[key] |
| 28 | return acc |
| 29 | }, {}) as T |
| 30 | } |
| 31 | |
| 32 | export function isObjectId(id: string): boolean { |
| 33 | return /^[0-9a-fA-F]{24}$/.test(id) |
no outgoing calls
no test coverage detected