1 | /**
|
2 | * This file is part of the @egodigital/egoose distribution.
|
3 | * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
|
4 | *
|
5 | * @egodigital/egoose is free software: you can redistribute it and/or modify
|
6 | * it under the terms of the GNU Lesser General Public License as
|
7 | * published by the Free Software Foundation, version 3.
|
8 | *
|
9 | * @egodigital/egoose is distributed in the hope that it will be useful, but
|
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12 | * Lesser General Public License for more details.
|
13 | *
|
14 | * You should have received a copy of the GNU Lesser General Public License
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16 | */
|
17 | import * as Enumerable from 'node-enumerable';
|
18 | /**
|
19 | * A string format provider function.
|
20 | *
|
21 | * @param {any} val The input value.
|
22 | * @param {string} match The original match value.
|
23 | *
|
24 | * @return {any} The output value.
|
25 | */
|
26 | export declare type StringFormatProvider = (val: any, match: string) => any;
|
27 | /**
|
28 | * A list of string format providers.
|
29 | */
|
30 | export declare type StringFormatProviderList = {
|
31 | [name: string]: StringFormatProvider;
|
32 | };
|
33 | /**
|
34 | * Formats a string.
|
35 | *
|
36 | * @param {any} formatStr The value that represents the format string.
|
37 | * @param {any[]} [args] The arguments for 'formatStr'.
|
38 | *
|
39 | * @return {string} The formated string.
|
40 | */
|
41 | export declare function format(formatStr: any, ...args: any[]): string;
|
42 | /**
|
43 | * Formats a string.
|
44 | *
|
45 | * @param {any} formatStr The value that represents the format string.
|
46 | * @param {Enumerable.Sequence<any>} [args] The arguments for 'formatStr'.
|
47 | *
|
48 | * @return {string} The formated string.
|
49 | */
|
50 | export declare function formatArray(formatStr: any, args: Enumerable.Sequence<any>): string;
|
51 | /**
|
52 | * Returns a (new) list of default string format providers, grouped by name.
|
53 | *
|
54 | * @return {StringFormatProviderList} The new list.
|
55 | */
|
56 | export declare function getDefaultStringFormatProviders(): StringFormatProviderList;
|
57 | /**
|
58 | * Registers a new list of global string format providers.
|
59 | *
|
60 | * @param {StringFormatProviderList} [providers] The new list.
|
61 | * @param {boolean} [withDefaults] Also register default providers first. Default: (true)
|
62 | */
|
63 | export declare function registerStringFormatProviders(providers?: StringFormatProviderList, withDefaults?: boolean): void;
|