/** * 数组内元素求和 * * ```ts * import { sum } from 'sunny-js' * console.log(sum([1, 2])) * // => 3 * ``` * * @category 数字 */ export declare function sum(input: number[]): number; /** * 返回百分数 * * ```ts * import { percent } from 'sunny-js' * console.log(percent(1, 2)) * // => '50%' * ``` * * @param numerator 分子 * @param denominator 分母 * @param fixedPoint 小数位精度 * @category 数字 */ export declare function percent(numerator: number | string, denominator: number | string, fixedPoint?: number): string; /** * 检查输入是否像数字 * * ```ts * import { isNum } from 'sunny-js' * isNum(1) // true * isNum('1') // true * isNum('1.1%') // true * isNum('1x') // true * ``` * * @category 数字 */ export declare function isNum(input: string | any): boolean; /** * 数字千位分隔符 * * ```ts * import { thousandsSeparators } from 'sunny-js' * console.log(thousandsSeparators(1234567)) * // => 1,234,567 * console.log(thousandsSeparators(1234567.1234567)) * // => 1,234,567.123 * console.log(thousandsSeparators(1234567.1234567, { maximumFractionDigits: 2 })) * // => 1,234,567.12 * ``` * * @deprecated 可以使用[Number.prototype.toLocaleString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString)替代 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString Number.prototype.toLocaleString()} * @param num 数字 * @param opts 数字格式化选项 * @category 数字 */ export declare function thousandsSeparators(num: number | string, opts?: Intl.NumberFormatOptions): string; /** * 生成范围随机数 * * ```ts * import { randInRange } from 'sunny-js' * // 0-10范围的随机数 * console.log(randInRange(0,10)) * ``` * * @param min 最低数 * @param max 最高数 * @category 数字 */ export declare function randInRange(min: number, max: number): number; /** * 生成id * * ```ts * import { uniqId } from 'sunny-js' * uniqId('id') * // => 'id0' * ``` * * @param prefix id前缀 * @category 数字 */ export declare const uniqId: { (prefix?: string): string; /** * @ignore */ _incrementId?: number; };