UNPKG

@playbooks/utils

Version:

A collection of utilities used for Playbooks.

121 lines (116 loc) 5.75 kB
// Generated by dts-bundle-generator v9.5.1 import { computeTailwind } from '@ehubbell/html'; import binaryExtensions from 'binary-extensions'; import Dayjs from 'dayjs'; export declare const addOrRemoveItem: (array: any[], record: any) => any[]; export declare const moveAndSort: (array: any[], record: any, dragIndex: any, hoverIndex: any, key?: string) => any[]; export declare const removeAndSort: (array: any, index: any) => any[]; export declare const updateAndSort: (array: any, record: any, index: any) => any; export declare const findRecordAndReplace: (array: any[], selectedRecord: any, newRecord: any, keyName: any) => any[]; export declare const getCountryCode: any; export declare const getCountryName: any; export declare const getCountryNames: any; export declare const dayjs: typeof Dayjs; export declare const zonedDayjs: (value?: any, timezone?: string) => Dayjs.Dayjs; export declare const fromUnix: (value?: number) => Dayjs.Dayjs; export declare const formatDate: (value?: any, format?: string) => string; export declare const formatTimestamp: (value?: any) => string; export declare const toDate: (value?: any) => Date; export declare const toJson: (value?: any) => string; export declare const toYear: (value?: any) => number; export declare const toUnix: (value?: any) => number; export declare const toStartOfTime: () => string; export declare const toEndOfTime: () => string; export declare const toTimezone: (value?: any, timezone?: string) => Dayjs.Dayjs; export declare const timeElapsed: (startDate: any, endDate?: Date) => string; export declare const performDownload: (response: any, fileName: any) => Promise<void>; export declare const normalizeError: (error: any) => { status: any; title: any; message: any; }; export declare const serializeError: (error: any) => { status: any; title: any; detail: any; source: any; }; export declare const objectionError: (e: any) => { status: any; title: any; detail: any; source: any; }; export declare const jsonApiError: (status: any, title: any, detail: any, source: any) => { status: any; title: any; detail: any; source: any; }; export declare const httpError: any; export declare const env: string; export declare const sleep: (ms: any) => Promise<unknown>; export declare const getSeconds: () => number; export declare const getRandomInt: (max?: number) => number; export declare const getUUID: (v?: number) => any; export declare const getPlural: (value: any) => any; export declare const getSingular: (value: any) => any; export declare const formatUUID: (url: any, index?: number) => any; export declare const mapChildren: (data: any, key: any) => any[]; export declare const buildArray: (count?: number) => number[]; export declare const chunkArray: (array: any, chunkSize: any) => any[]; export declare const shuffleArray: (array: any) => any; export declare const computeBytes: (data: any, unit?: string) => any; export declare const isArray: (data: any) => data is any[]; export declare const isDate: (data: any) => boolean; export declare const isFunction: (data: any) => boolean; export declare const isObject: (data: any) => boolean; export declare const isString: (data: any) => data is string; export declare const isEmpty: (data: any) => boolean; export declare const htmlToText: (data: any, options?: any) => any; export declare const stripHtmlEntities: (data?: string) => string; export declare const clearInput: (element: any) => void; export declare class logger { static log: (title: any, ...data: any[]) => void; static error: (title: any, ...data: any[]) => void; static warn: (title: any, ...data: any[]) => void; static info: (title: any, ...data: any[]) => void; static success: (title: any, ...data: any[]) => void; static debug: (title: any, ...data: any[]) => void; } export declare const avg: (array?: any[]) => number; export declare const max: (array?: any[]) => number; export declare const min: (array?: any[]) => number; export declare const sum: (array?: any[]) => any; export declare const nonAlphaNumericRegex: RegExp; export declare const alphaNumericRegex: RegExp; export declare const httpRegex: RegExp; export declare const nonAlphaNumericRegexString = "[^a-zA-Z0-9- ]"; export declare const alphaNumericRegexString = "^([a-zA-Z]|[0-9]|-)+$"; export declare const httpRegexString = "^https?://"; export declare const camelToUnderscore: (data?: string) => string; export declare const camelToDash: (data?: string) => string; export declare const camelToString: (data?: string) => string; export declare const dashToCamel: (data?: string) => string; export declare const dashToCapital: (data?: string) => string; export declare const dashToString: (data?: string) => string; export declare const dashToUnderscore: (data?: string) => string; export declare const phoneToString: (data?: string) => string; export declare const capitalize: (data?: string) => string; export declare const deCapitalize: (data?: string) => string; export declare const stringToUnderscore: (data?: string) => string; export declare const underscoreToString: (data?: string) => string; export declare const truncate: (data?: string, count?: number, ellipsis?: boolean) => string; export declare const toPhone: (value?: string) => string; export declare const toCurrency: (value: any, precision?: number) => string; export declare const toNumber: (value: any, decimal?: number) => string; export declare const toShortNumber: (value?: number, decimal?: number) => string; export declare const toPercent: (value?: number) => string; export declare const toCents: (value?: number) => number; export declare const fromCents: (value?: number) => number; export * from "js-base64"; export { binaryExtensions, computeTailwind, }; export {};