MCPcopy Create free account
hub / github.com/chainjet/platform / convertKeys

Function convertKeys

libs/common/src/utils/object.utils.ts:25–30  ·  view source on GitHub ↗
(object: T, fn: (key: string) => string)

Source from the content-addressed store, hash-verified

23export const isEmptyObj = (obj: Record<string, any>): boolean => Object.keys(obj).length <= 0
24
25export 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
32export function isObjectId(id: string): boolean {
33 return /^[0-9a-fA-F]{24}$/.test(id)

Callers 2

runMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected