@allgemein/schema-api
Version:
Library for schema api
40 lines (39 loc) • 1.21 kB
TypeScript
import { IClassRef } from '../api/IClassRef';
import { IEntityRef } from '../api/IEntityRef';
import { IBuildOptions } from '../api/IBuildOptions';
export declare class SchemaUtils {
/**
* convert an json entry to an instance of given entityRef type
*
* - with options can be set pre/post processing for build
* - beforeBuild - preprocess of an object
* - afterBuild - postprocess of an object
* - createAndCopy - if true the only the instance is created, all properties are passed by assign
*
* @param entityRef
* @param data
* @param options: IBuildOptions
*
*/
static transform<T>(entityRef: IEntityRef | IClassRef, data: any, options?: IBuildOptions): T;
/**
* Create a class of given name
*
* @param str
*/
static clazz(str: string): Function;
/**
* Create a class of given name
*
* @param str
*/
static clazzAnonymous(): Function;
/**
* Return inherited class if present else null will be delivered
*
* @param klass
*/
static getInherited(klass: Function): any;
static getFunction(klass: any): Function;
static normValue(value: any): any;
}