UNPKG

2.37 kBTypeScriptView Raw
1import { RawParams } from '../params/interface';
2import { ParamType } from './paramType';
3import { StateDeclaration } from '../state';
4import { UrlConfig } from '../url';
5declare enum DefType {
6 PATH = 0,
7 SEARCH = 1,
8 CONFIG = 2
9}
10export { DefType };
11export declare class Param {
12 id: string;
13 type: ParamType;
14 location: DefType;
15 isOptional: boolean;
16 dynamic: boolean;
17 raw: boolean;
18 squash: boolean | string;
19 replace: [{
20 to: any;
21 from: any;
22 }];
23 inherit: boolean;
24 array: boolean;
25 config: any;
26 /** Cache the default value if it is a static value */
27 _defaultValueCache: {
28 defaultValue: any;
29 };
30 static values(params: Param[], values?: RawParams): RawParams;
31 /**
32 * Finds [[Param]] objects which have different param values
33 *
34 * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects
35 *
36 * @param params: The list of Param objects to filter
37 * @param values1: The first set of parameter values
38 * @param values2: the second set of parameter values
39 *
40 * @returns any Param objects whose values were different between values1 and values2
41 */
42 static changed(params: Param[], values1?: RawParams, values2?: RawParams): Param[];
43 /**
44 * Checks if two param value objects are equal (for a set of [[Param]] objects)
45 *
46 * @param params The list of [[Param]] objects to check
47 * @param values1 The first set of param values
48 * @param values2 The second set of param values
49 *
50 * @returns true if the param values in values1 and values2 are equal
51 */
52 static equals(params: Param[], values1?: {}, values2?: {}): boolean;
53 /** Returns true if a the parameter values are valid, according to the Param definitions */
54 static validates(params: Param[], values?: RawParams): boolean;
55 constructor(id: string, type: ParamType, location: DefType, urlConfig: UrlConfig, state: StateDeclaration);
56 isDefaultValue(value: any): boolean;
57 /**
58 * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the
59 * default value, which may be the result of an injectable function.
60 */
61 value(value?: any): any;
62 isSearch(): boolean;
63 validates(value: any): boolean;
64 toString(): string;
65}