/** * A Utility class that has several static methods to assist in development. * * @class Util * @module StructureJS * @submodule util * @author Robert S. (www.codeBelt.com) * @static */ declare class Util { /** * Keeps track of the count for the uniqueId method. * * @property _idCounter * @type {int} * @private * @static */ private static _idCounter; constructor(); /** * Generates a unique ID. If a prefix is passed in, the value will be appended to it. * * @method uniqueId * @param [prefix] {string} The string value used for the prefix. * @returns {init|string} Returns the unique identifier. * @public * @static * @example * let property = Util.uniqueId(); * // 1 * * let property = Util.uniqueId('prefixName_'); * // prefixName_1 */ static uniqueId(prefix?: string): any; /** * Removes a list of properties from an object. * * @method deletePropertyFromObject * @param object {Object} The object you want to remove properties from. * @param value {string|Array.} A property name or an array of property names you want to remove from the object. * @returns {any} Returns the object passed in without the removed the properties. * @public * @static * @example * let obj = { name: 'Robert', gender: 'male', phone: '555-555-5555' } * * Util.deletePropertyFromObject(obj, ['phone', 'gender']); * * // { name: 'Robert' } */ static deletePropertyFromObject(object: any, value: string | Array): any; /** * Renames a property name on an object. * * @method renamePropertyOnObject * @param object {Object} The object you want to rename properties from. * @param oldName {string} * @param newName {string} * @returns {any} Returns the object passed in renamed properties. * @public * @static * @example * let obj = { name: 'Robert', gender: 'male', phone: '555-555-5555' } * * Util.renamePropertyOnObject(obj, 'gender', 'sex'); * * // { name: 'Robert', sex: 'male', phone: '555-555-5555' } */ static renamePropertyOnObject(object: any, oldName: string, newName: string): any; /** * Makes a clone of an object. * * @method clone * @param obj {Object} The object you to clone. * @returns {any} Returns a clone object of the one passed in. * @public * @static * @example * let cloneOfObject = Util.clone(obj); */ static clone(obj: any): any; /** * Converts a string or number to a boolean. * * @method toBoolean * @param strNum {string|number} * @returns {boolean} * @public * @static * @example * Util.toBoolean("TRUE"); * // true * * Util.toBoolean(0); * // false * * Util.toBoolean(undefined); * // false */ static toBoolean(strNum: any): boolean; /** * Returns the name of the function/object passed in. * * @method getName * @param classObject {any} * @returns {string} Returns the name of the function or object. * @static * @example * let someClass = new SomeClass(); * Util.getName(someClass); // 'SomeClass' * * Util.getName(function Test(){}); // 'Test' * Util.getName(function (){}); // 'anonymous' */ static getName(classObject: any): string; /** * Creates and returns a new debounced version of the passed function which will postpone its execution until after * wait milliseconds have elapsed since the last time it was invoked. * * @method debounce * @param callback {Function} The function that should be executed. * @param wait {number} Milliseconds to elapsed before invoking the callback. * @param immediate {boolean} Pass true for the immediate parameter to cause debounce to trigger the function on the leading instead of the trailing edge of the wait interval. Useful in circumstances like preventing accidental double-clicks on a "submit" button from firing a second time. * @param callbackScope {any} The scope of the callback function that should be executed. * @public * @static * @example * Util.debounce(this._onBreakpointChange, 250, false, this); */ static debounce(callback: Function, wait: number, immediate: boolean, callbackScope: any): Function; /** * TODO: YUIDoc_comment * * @method applyMixins * @param derivedCtor {any} * @param baseCtors {any} * @public * @static * @example * class Flies { fly() { alert('Is it a bird? Is it a plane?'); } } class Climbs { climb() { alert('My spider-sense is tingling.'); } } class HorseflyWoman implements Climbs, Flies { climb: () => void; fly: () => void; } Util.applyMixins(HorseflyWoman, [Climbs, Flies]); */ static applyMixins(derivedCtor: any, baseCtors: any[]): void; /** * Returns a new array with duplicates removed. * * @method unique * @param list {Array.} The array you want to use to generate the unique array. * @return {Array} Returns a new array list of unique items. * @protected */ static unique(list: Array): Array; } export default Util;