@egodigital/nef
Version:
Managed Extensibility Framework like library written for Node.js
59 lines (58 loc) • 1.89 kB
TypeScript
/**
* This file is part of the @egodigital/nef distribution.
* Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
*
* @egodigital/nef is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 3.
*
* @egodigital/nef is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Keeps sure to return a value as array.
*
* @param {T|T[]} val The input value.
*
* @return {T[]} The output value.
*/
export declare function asArray<T>(val: T | T[]): T[];
/**
* Returns classes of an object deep.
*
* @param {any} obj The object.
*
* @return {any[]} The list of classes.
*/
export declare function getClassesFromObject(obj: any): any[];
/**
* Loads a module.
*
* @param {string} file The path to the module.
* @param {boolean} [useCache] Use cache or not.
*
* @return {TModule} The module.
*/
export declare function loadModule<TModule = any>(file: string, useCache?: boolean): TModule;
/**
* Converts a value to a boolean, if needed.
*
* @param {any} val The input value.
* @param {boolean} [defaultValue] The custom default value.
*
* @return {string} The output value.
*/
export declare function toBooleanSafe(val: any, defaultValue?: boolean): boolean;
/**
* Converts a value to a string, if needed, that is not (null) and (undefined).
*
* @param {any} val The input value.
*
* @return {string} The output value.
*/
export declare function toStringSafe(val: any): string;