UNPKG

@swaptoshi/utils

Version:

Library containing generic utility functions for use with Swaptoshi-related software

21 lines (20 loc) 1.15 kB
import { Schema } from '@klayr/codec'; import { ConfigPathKeys, ConfigPathType, UpdatedProperty } from './types'; type iSchema = Schema & { dataType: string; items: Schema & { dataType: string; items: any; }; }; type Primitive = string | number | bigint | boolean | null | undefined | object; export declare function removeProperty(obj: object, propsToRemove: string[]): object; export declare function getSchemaByPath(schema: Schema, path: string): Schema; export declare function getArrayTypeBySchema(schemaDef: iSchema): string; export declare function valueToString(val: Primitive): string; export declare function getUpdatedProperties(oldObject: object, newObject: object, schema: Schema): UpdatedProperty[]; export declare function getValueFromPath<T extends object, P extends ConfigPathKeys<T>>(obj: T, path: P): ConfigPathType<T, P>; export declare function updateValueFromPath<T extends object>(obj: T, path: string, value: unknown): T; export declare function pathExists(obj: object, path: string): boolean; export declare function serializer<T extends Record<any, any>>(data: T, schema?: any): T; export {};