sql-ddl-to-json-schema
Version:
Parse and convert SQL DDL statements to a JSON Schema.
75 lines (74 loc) • 2.38 kB
TypeScript
import { TransformerFunction, TMap, AnyMap } from '../typings/utils';
/**
* Transform an array of strings into an object, optionally
* transforming values of keys and values.
*
* @example
* Input: ['VARIABLE', 'VAR'], k => '_' + k
* Output: { _VARIABLE: 'VARIABLE', _VAR: 'VAR' }
*
* @param array Function that returns string.
* @param transformKey Function that transforms the object key.
* @param transformValue Function that transforms the object value.
*/
export declare function stringArrayToMapping<T>(array?: string[], transformKey?: TransformerFunction<string>, transformValue?: TransformerFunction<T>): TMap<T>;
/**
* Trim ends of string from chars given.
* Default chars are whitespaces and tabs.
*
* @param string String to be trimmed.
* @param additional Additional character list to trim.
* @param chars Defult character list to trim.
*/
export declare function trimString(string: string, additional?: string, chars?: string): string;
/**
* Return the same instance of object without
* the properties containing null values.
*
* @param obj Object to be filtered.
*/
export declare function filterNullValues(obj: AnyMap): AnyMap;
/**
* Test whether given value is array.
*
* @param value Value to be tested.
*/
export declare function isArray(value: any): value is any[];
/**
* Test whether given value is string.
*
* @param value Value to be tested.
*/
export declare function isString(value: any): value is string;
/**
* Test whether given value is number.
*
* @param value Value to be tested.
*/
export declare function isNumber(value: any): value is number;
/**
* Test whether given value is function.
*
* @param value Value to be tested.
*/
export declare function isFunction(value: any): value is Function;
/**
* Test whether given value is object.
*
* @param value Value to be tested.
*/
export declare function isObject(value: any): value is AnyMap;
/**
* Test whether given value is defined and not null.
*
* @param value Value to be tested.
*/
export declare function isDefined<T>(value: T): value is NonNullable<T>;
/**
* Set an enumarable, configurable and writable property of given target object.
*
* @param target Target object to have property set on.
* @param key Property key.
* @param value Property value.
*/
export declare function setProperty(target: any, key: string, value: any): void;