UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

87 lines (85 loc) 3.9 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import Person from '../models/Person'; /** * Converts a string separated by dashes into a * camelCase equivalent. For instance, 'foo-bar' * would be converted to 'fooBar'. **/ export declare function camelize(str: string): string; /** * Capitalizes the first letter of a string and down-cases all the others. **/ export declare function capitalize(str: string): string; /** * Converts a camelized string into a series of words separated by an underscore (_). **/ export declare function underscore(str: string): string; /** * Replaces every instance of the underscore character "_" by a dash "-". **/ export declare function dasherize(str: string): string; export declare function removeSpaces(str: string): string; export declare function removeLastPiece(str: string, splitChar?: string): string; export declare function popPiece(str: string, splitChar?: string): string; export declare function isJSON(str: string): boolean; export declare function hasUppercaseChars(str: string): boolean; export declare function getInitials(str: string): string; export declare function getInitials(person: Person): string; export declare function formatBytes(bytes: number, decimals?: number): string; export declare function isBlank(str: string): boolean; export declare function dataUriToBlob(dataURI: string): Blob; export declare function fileNameFromPath(path: string): string; export declare function escapeHTML(str: string): string; export declare function unescapeHTML(html: string): string; export declare function legacyEscapeXml(value: string): string; export declare function legacyUnescapeXml(value: string): string; export declare function bytesToSize(bytes: number, separator?: string): string; /** * Removes double slashes from urls * @param url {string} The URL to clean up */ export declare function ensureSingleSlash(url: string): string; export declare function getSimplifiedVersion( version: string, options?: { minor?: boolean; patch?: boolean; } ): string; export declare function preFill(str: string | number, minLength?: number, char?: string): string; export declare function postFill(str: string | number, minLength?: number, char?: string): string; export declare const isSimple: (str: string | number, separator?: string) => boolean; export declare const isSymmetricCombination: ( string1: string | number, string2: string | number, separator?: string ) => boolean; export declare function stripCData(str: string): string; export declare function toColor(str: string): string; export declare const replaceAccentedVowels: (input: any) => any; export declare function isPath(str: string): boolean; export declare function isUUID(str: string): boolean; /** * Takes a string in any of our possible version formats and converts it to a number that can be compared coherently * with other versions that went through this process. Examples: * 4.2.22 => 004.002.022 => 4002022 * 5.0.0E => 005.000.000 => 5000000 * 4.3.0-SNAPSHOT => 004.003.000 => 4003000 * @param versionStr {string} The version string to convert * @return {number} The version converted to a number **/ export declare function versionStringToInt(versionStr: string): number;