/** * Copyright 2026 - present Nazmul Hassan * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { $ as TruncateOptions, W as RandomIdOptions } from "./string-C1gMz4HF.mjs"; //#region src/string/basics.d.ts /** * * Utility to truncate a string to a specified length. * * @param str The string to truncate. * @param maxLength The maximum length of the truncated string. Defaults to `100`. * @returns Truncated string with ellipsis (`'...'`) (only if it has more length than `maxLength`). */ declare function truncateString(str: string, maxLength?: number): string; /** * * Utility to truncate a string to a specified length using options. * * @param str The string to truncate. * @param options Options for truncating the string. * @returns Truncated string based on the {@link options}. */ declare function truncateString(str: string, options?: TruncateOptions): string; /** * * Generates a random alphanumeric (16 characters long, this length is customizable in the options) ID string composed of an optional `prefix`, `suffix`, a `timestamp`, `caseOption` and a customizable `separator`. * * @param options Configuration options for random ID generation. * @returns The generated ID string composed of the random alphanumeric string of specified length with optional `timeStamp`, `prefix`, and `suffix`, `caseOption` and `separator`. * * @see {@link https://toolbox-x.vercel.app/docs/utils/hash/uuid uuid} for `uuid` generation * @see {@link https://toolbox-x.vercel.app/docs/utils/hash/random-numeric randomHex} for random numeric string generation * @see {@link https://toolbox-x.vercel.app/docs/utils/hash/random-hex randomHex} for random hexadecimal string generation * * @example * // Generate an ID with all default options * const id = generateRandomID(); * // Example output: "swo8ckxwsc13w7xw" * * @example * // Generate an ID with a custom prefix and separator * const id = generateRandomID({ prefix: 'ID', separator: '-' }); * // Example output: "ID-eh1ymwfxzwas9jte" * * @example * // Generate an ID with a timestamp * const id = generateRandomID({ timeStamp: false }); * // Example output: "1764610287501pd3r4w85qwkuulgf" * * @example * // Generate an ID with a custom length for the random string * const id = generateRandomID({ length: 8 }); * // Example output: "i623uiev" * * @example * // Generate an ID with a custom suffix * const id = generateRandomID({ suffix: 'END' }); * // Example output: "3csf27a4800rbli9END" * * @example * // Generate an ID with a uppercase random string * const id = generateRandomID({ caseOption: "upper" }); * // Example output: "H0VNU6O8XV1Y30HG" * * @example * // Generate an ID with all options customized * const id = generateRandomID({ * prefix: 'ID', * suffix: 'END', * timeStamp: true, * length: 10, * separator: '-', * caseOption: "upper" * }); * // Example output: "ID-1764610471474-4KSL51IB91-END" */ declare function generateRandomID(options?: RandomIdOptions): string; /** * * Trims all whitespaces in a string. * * @param input The string to trim. * @returns Trimmed string. */ declare function trimString(input: string): string; /** * * Trims all whitespaces in an array of strings. * * @param input The array of strings to trim. * @returns Trimmed array of strings. */ declare function trimString(input: string[]): string[]; //#endregion export { trimString as n, truncateString as r, generateRandomID as t };