UNPKG

@teamsnap/teamsnap-ui

Version:

a CSS component library for TeamSnap

102 lines (101 loc) 2.57 kB
/** * @name capitalize * * @description * This simple method returns a capitalized version of the provided string. * Currently it is a 'wrapper' around the lodash _capitalize method. * There are other utilities we can look into as well, such as `shortid` * * @example * import { capitalize } from 'utils/helpers * * capitalize('name') * */ export declare const capitalize: (string: string) => string; /** * @name generateUniqueId * * @description * This simple method returns a string representing a uniqueID. * Currently it is a 'wrapper' around the lodash uniqueId method. * There are other utilities we can look into as well, such as `shortid` * * @example * import { generateUniqueId } from 'utils/helpers * * generateUniqueId() * */ export declare const generateUniqueId: (prefix?: string) => any; /** * @name setUniqueId * * @description * Set a uniqueID on an object if no id is provided. * Accepts an array of objects, the property name to create * * @example * import { setUniqueId } from 'utils/helpers * * setUniqueId([{name: 'item one'}], 'uuid') * */ export declare const setUniqueId: (items: any, property?: string) => any; /** * @name parseAlphaString * * @description * Parse alpha characters from a provided string. * * @example * import { parseAlphaString } from 'utils/helpers * * parseAlphaString('abcd 1234 dcba') * */ export declare const parseAlphaString: (value: any) => any; /** * @name parseNumericString * * @description * Parse Numeric characters, periods and negation from a provided string. * * @example * import { parseNumericString } from 'utils/helpers * * parseNumericString('abcd 1234 dcba') * */ export declare const parseNumericString: (value: any) => string; /** * @name stringifyArray * * @description * Used to quickly filter out and join an array by 'truthy' values. * * @example * import { stringifyArray } from 'utils/helpers * * stringifyArray(['Simpson', 'Homer'], ', ') * */ export declare const stringifyArray: (array: any, joinBy?: string) => any; /** * @name getClassName * * @description * Takes a base className and calls stringifyArray to merge 'truthy' options into a single string it returns * * @example * import { getClassName } from 'utils/helpers * * getClassName( * 'BaseClassName', * isInline && 'InlineModifier', * isActive ? 'ActiveModifier' : 'InactiveModifier' * 'some-utility-modifier' * ) * */ export declare const getClassName: (className: any, ...classModifiers: any[]) => any;