wj-config
Version:
Javascript configuration module for NodeJS and browser frameworks such as React that works like ASP.net configuration where data sources are specified (usually JSON files) and environment variables can contribute/overwrite values by following a naming con
44 lines • 2.17 kB
TypeScript
import { ConfigurationNode, Dictionary } from "./wj-config.js";
/**
* Tests the provided object to determine if it is an array.
* @param obj Object to test.
* @returns True if the object is an array; false otherwise.
*/
export declare function isArray(obj: unknown): obj is any[];
/**
* Tests the provided object to determine if it is an object that can be considered a non-leaf property in a
* configuration object.
* @param obj Object to test.
* @returns True if the object is a non-leaf object; false otherwise.
*/
export declare function isConfigNode(obj: unknown): obj is ConfigurationNode;
/**
* Tests a particular object to determine if it is a dictionary.
* @param obj Object to test.
* @returns `true` if the object is a dictionary, or `false` otherwise.
*/
export declare function isDictionary(obj: unknown): obj is Dictionary;
/**
* Tests the provided object to determine if it is a function.
* @param obj Object to test.
* @returns True if the object is a function; false otherwise.
*/
export declare function isFunction(obj: unknown): obj is Function;
/**
* Enumerates all the properties of the specified object that are owned by the object, therefore excluding the ones
* inherited from the prototype.
* @param obj Object whose properties will be enumerated.
* @param loopBody Callback function that receives the property name (key), value and index. If the callback returns
* truthy then the enumeration stops.
*/
export declare const forEachProperty: <T extends Record<string, any>>(obj: T | undefined, loopBody: (key: keyof T, value: any, index?: number) => boolean | void) => void;
/**
* Attempts to parse the provided value in order to convert it to a more specialized primitive type.
*
* Specifically it will attempt to obtain a Boolean, integer or floating point value. If all fails, then the value
* is kept as a string.
* @param value Value to parse.
* @returns The converted value, or the value's string representation if no conversion was possible.
*/
export declare const attemptParse: (value: (string | undefined | null)) => string | number | boolean | null | undefined;
//# sourceMappingURL=helpers.d.ts.map