@kwaeri/developer-tools
Version:
The kwaeri developer tools. A minimalist tooling for kwaeri application development.
104 lines (103 loc) • 4.18 kB
text/typescript
/**
* SPDX-PackageName: kwaeri/developer-tools
* SPDX-PackageVersion: 0.10.1
* SPDX-FileCopyrightText: © 2014 - 2022 Richard Winters <kirvedx@gmail.com> and contributors
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR MIT
*/
/**
* Class for implementing the Kwaeri Developer Tools (kdt)
*/
export declare class kdt {
/**
* A list of types for easing the implementation of our .type() method
*
* @var { object }
*/
private classmap;
/**
* Class constructor
*/
constructor();
/**
* Checks the type of any entity
*
* @param { any } query The query to be type checked
*
* @returns { string } String The lowercase short variant of the type the entity evaluated to.
*/
type(...args: any[]): string;
/**
* Checks if an object is empty or not
*
* @param { object } The object which we check is empty
*
* @return { boolean } true if empty, false otherwise
*/
empty(...args: any[]): boolean;
/**
* An extend method that mimics jQuery and it's deep copy trait
*
* @param { object } a
* @param { object } b
* @param { object } x
*
* @return { object } a extended by b through x
*/
extend(...args: any[]): object;
/**
* Method to apply mix-in [partial] classes to a base class. Based entirely on the official documentation
* for the 'Alternate Version' - as described at:
* https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern
*
* @param { any } derivedCtor The derived class being extended. Must be the named interface of the class.
* @param { any } constructors The base classes to inherit from. Must be the named interfaces of the classes.
*
* @returns { void }
*/
compose(derivedCtor: any, constructors: any[]): void;
/**
* Method for iterating over an object or list and performing an action for each index
*
* @param { object|array } iteratee The object or array being iterated over
* @param { function } applicator The action to apply to each index of the iteratee, can be suppieda key/value arguments
*
* @return { boolean } Returns true if all went well, otherwise false
*/
each(iteratee: any, applicator: any): boolean;
/**
* A specialized method for checking if an entity/variable is a number
*
* @param { any } entity
*
* @return { boolean } Returns true if the entity is a number, otherwise false
*/
isNumber(entity: any): boolean;
/**
* Helper method to determine if a property [chain] exists in an object
*
* @param { object } container The object for - and in - which the property chain is being checked.
* @param { string } propertyChain The property chain being tested for. Nested properties can be notated with periods (x.y)
* @returns True if the property chain exists, false if it does not.
*/
has(container: Object | any[], propertyChain: string): any;
/**
* Gets the specified value from the provided object if it exists, or returns the default value (or null)
*
* @param { Object } base The object a value is requested from
* @param { string } property The name of the property that should belong to the object a value is requested from
* @param { any } defaultValue A defaultvalue to return in the event either the provided object or requested property does not exist
*
* @returns { any }
*/
get(base: Object | undefined, property: string | number, defaultValue?: any): any;
/**
* Sets the specified value to the specified property on the provided object
*
* @param { Object|Array<any> } base The provided object for which the specified value is to be set for the specified property
* @param { string|number }property The property of the provided object for which to set the specified value
* @param { any } value The value to set for the specified property of the provided object
*
* @returns { any }
*/
set(base?: Object | Array<any>, property?: string | number, value?: any): any;
}