@vertexvis/utils 0.24.5-canary.5 → 1.0.0-testing.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/async.d.ts +79 -79
- package/dist/binaryReader.d.ts +58 -58
- package/dist/browser.cjs.js +1202 -1351
- package/dist/browser.cjs.js.map +1 -1
- package/dist/browser.esm.js +1197 -1351
- package/dist/browser.esm.js.map +1 -1
- package/dist/bundle.cjs.js +1199 -1344
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +1197 -1343
- package/dist/bundle.esm.js.map +1 -1
- package/dist/color.d.ts +62 -62
- package/dist/disposable.d.ts +10 -10
- package/dist/eventDispatcher.d.ts +16 -16
- package/dist/eventTargets.d.ts +10 -10
- package/dist/index.d.ts +19 -19
- package/dist/mappedTypes.d.ts +49 -49
- package/dist/mapper.d.ts +270 -270
- package/dist/objects.d.ts +72 -72
- package/dist/predicate.d.ts +5 -5
- package/dist/range.d.ts +86 -86
- package/dist/sets.d.ts +1 -1
- package/dist/sort.d.ts +21 -21
- package/dist/strings.d.ts +3 -3
- package/dist/uri.d.ts +56 -56
- package/dist/uuid.d.ts +8 -8
- package/package.json +11 -11
package/dist/objects.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a new object where any enumerable property from `other` are
|
|
3
|
-
* recursively applied to `a`. Once a property is set, it will not be
|
|
4
|
-
* overridden. This function is useful for constructing configs from a default
|
|
5
|
-
* config.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```
|
|
9
|
-
* defaults({ 'a': [1] }, { 'b': 2 }, { 'a': [2] });
|
|
10
|
-
* // => { a: [1], b: 2 }
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function defaults<A>(a: A): A;
|
|
14
|
-
export declare function defaults<A, B>(a: A, b: B): A & B;
|
|
15
|
-
export declare function defaults<A, B, C>(a: A, b: B, c: C): A & B & C;
|
|
16
|
-
export declare function defaults<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
|
|
17
|
-
export declare function defaults<A, R>(a: A, ...other: Record<string, unknown>[]): R;
|
|
18
|
-
/**
|
|
19
|
-
* Returns `true` if this is a plain object, which is defined by a type created
|
|
20
|
-
* by the `Object` constructor. Returns `false` otherwise.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```
|
|
24
|
-
* isPlainObject(Object.create({})); //=> true
|
|
25
|
-
* isPlainObject(Object.create(Object.prototype)); //=> true
|
|
26
|
-
* isPlainObject({foo: 'bar'}); //=> true
|
|
27
|
-
* isPlainObject({}); //=> true
|
|
28
|
-
*
|
|
29
|
-
* isPlainObject(1); //=> false
|
|
30
|
-
* isPlainObject(['foo', 'bar']); //=> false
|
|
31
|
-
* isPlainObject([]); //=> false
|
|
32
|
-
* isPlainObject(new Foo); //=> false
|
|
33
|
-
* isPlainObject(null); //=> false
|
|
34
|
-
* isPlainObject(Object.create(null)); //=> false
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function isPlainObject(obj: unknown): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Performs a deep comparison of two objects and returns `true` if they're
|
|
40
|
-
* equal.
|
|
41
|
-
*
|
|
42
|
-
* This method supports comparing arrays, array buffers, booleans, date objects,
|
|
43
|
-
* error objects, maps, numbers, Object objects, regexes, sets, strings,
|
|
44
|
-
* symbols, and typed arrays. Object objects are compared by their own, not
|
|
45
|
-
* inherited, enumerable properties. Functions and DOM nodes are compared by
|
|
46
|
-
* strict equality, i.e. ===.
|
|
47
|
-
*
|
|
48
|
-
* @param a The object to compare with `b`.
|
|
49
|
-
* @param b The object to compare with `a`.
|
|
50
|
-
* @returns `true` if the two objects are equal. Otherwise `false`.
|
|
51
|
-
*/
|
|
52
|
-
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Returns an array of key-value pairs for each enumerable key in `obj`.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```
|
|
58
|
-
* toPairs({a: 1, b: 2}); //=> [['a', 1], ['b', 2]]
|
|
59
|
-
* toPairs(['a', 'b']); //=> [['0', 'a'], ['1', 'b']]
|
|
60
|
-
*
|
|
61
|
-
* function Foo() {
|
|
62
|
-
* this.a = 1;
|
|
63
|
-
* this.b = 2;
|
|
64
|
-
* }
|
|
65
|
-
* toPairs(new Foo()); //=> [['a', 1], ['b', 2]]
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export declare function toPairs<T>(obj: Record<string, T>): Array<[string, T]>;
|
|
69
|
-
export declare function toPairs<T>(obj: T[]): Array<[string, T]>;
|
|
70
|
-
export declare function toPairs(obj: object | null | undefined): Array<[string, any]>;
|
|
71
|
-
export declare function fromPairs<T>(pairs: Array<[string, T]> | undefined | null): Record<string, T>;
|
|
72
|
-
export declare function fromPairs(pairs: Array<unknown[]> | undefined | null): Record<string, unknown>;
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new object where any enumerable property from `other` are
|
|
3
|
+
* recursively applied to `a`. Once a property is set, it will not be
|
|
4
|
+
* overridden. This function is useful for constructing configs from a default
|
|
5
|
+
* config.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
* defaults({ 'a': [1] }, { 'b': 2 }, { 'a': [2] });
|
|
10
|
+
* // => { a: [1], b: 2 }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function defaults<A>(a: A): A;
|
|
14
|
+
export declare function defaults<A, B>(a: A, b: B): A & B;
|
|
15
|
+
export declare function defaults<A, B, C>(a: A, b: B, c: C): A & B & C;
|
|
16
|
+
export declare function defaults<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
|
|
17
|
+
export declare function defaults<A, R>(a: A, ...other: Record<string, unknown>[]): R;
|
|
18
|
+
/**
|
|
19
|
+
* Returns `true` if this is a plain object, which is defined by a type created
|
|
20
|
+
* by the `Object` constructor. Returns `false` otherwise.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* isPlainObject(Object.create({})); //=> true
|
|
25
|
+
* isPlainObject(Object.create(Object.prototype)); //=> true
|
|
26
|
+
* isPlainObject({foo: 'bar'}); //=> true
|
|
27
|
+
* isPlainObject({}); //=> true
|
|
28
|
+
*
|
|
29
|
+
* isPlainObject(1); //=> false
|
|
30
|
+
* isPlainObject(['foo', 'bar']); //=> false
|
|
31
|
+
* isPlainObject([]); //=> false
|
|
32
|
+
* isPlainObject(new Foo); //=> false
|
|
33
|
+
* isPlainObject(null); //=> false
|
|
34
|
+
* isPlainObject(Object.create(null)); //=> false
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function isPlainObject(obj: unknown): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Performs a deep comparison of two objects and returns `true` if they're
|
|
40
|
+
* equal.
|
|
41
|
+
*
|
|
42
|
+
* This method supports comparing arrays, array buffers, booleans, date objects,
|
|
43
|
+
* error objects, maps, numbers, Object objects, regexes, sets, strings,
|
|
44
|
+
* symbols, and typed arrays. Object objects are compared by their own, not
|
|
45
|
+
* inherited, enumerable properties. Functions and DOM nodes are compared by
|
|
46
|
+
* strict equality, i.e. ===.
|
|
47
|
+
*
|
|
48
|
+
* @param a The object to compare with `b`.
|
|
49
|
+
* @param b The object to compare with `a`.
|
|
50
|
+
* @returns `true` if the two objects are equal. Otherwise `false`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Returns an array of key-value pairs for each enumerable key in `obj`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```
|
|
58
|
+
* toPairs({a: 1, b: 2}); //=> [['a', 1], ['b', 2]]
|
|
59
|
+
* toPairs(['a', 'b']); //=> [['0', 'a'], ['1', 'b']]
|
|
60
|
+
*
|
|
61
|
+
* function Foo() {
|
|
62
|
+
* this.a = 1;
|
|
63
|
+
* this.b = 2;
|
|
64
|
+
* }
|
|
65
|
+
* toPairs(new Foo()); //=> [['a', 1], ['b', 2]]
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function toPairs<T>(obj: Record<string, T>): Array<[string, T]>;
|
|
69
|
+
export declare function toPairs<T>(obj: T[]): Array<[string, T]>;
|
|
70
|
+
export declare function toPairs(obj: object | null | undefined): Array<[string, any]>;
|
|
71
|
+
export declare function fromPairs<T>(pairs: Array<[string, T]> | undefined | null): Record<string, T>;
|
|
72
|
+
export declare function fromPairs(pairs: Array<unknown[]> | undefined | null): Record<string, unknown>;
|
package/dist/predicate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines a function that takes a value and returns `true` if the condition is
|
|
3
|
-
* satisfied, or `false` if it doesn't.
|
|
4
|
-
*/
|
|
5
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* Defines a function that takes a value and returns `true` if the condition is
|
|
3
|
+
* satisfied, or `false` if it doesn't.
|
|
4
|
+
*/
|
|
5
|
+
export type Predicate<T> = (value: T) => boolean;
|
package/dist/range.d.ts
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A `Range` represents a sequence of numbers from a starting point to ending
|
|
3
|
-
* point.
|
|
4
|
-
*/
|
|
5
|
-
export interface Range {
|
|
6
|
-
start: number;
|
|
7
|
-
end: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Returns a new `Range` with the given start and end points.
|
|
11
|
-
*/
|
|
12
|
-
export declare const create: (start: number, end: number) => Range;
|
|
13
|
-
/**
|
|
14
|
-
* Returns a new `Range` with the start and end points at the given position.
|
|
15
|
-
*/
|
|
16
|
-
export declare const at: (position: number) => Range;
|
|
17
|
-
/**
|
|
18
|
-
* Returns a new `Range` with the given start point and length.
|
|
19
|
-
*/
|
|
20
|
-
export declare const withLength: (start: number, len: number) => Range;
|
|
21
|
-
/**
|
|
22
|
-
* Returns a range with the start and end points shifted by the given distance.
|
|
23
|
-
*/
|
|
24
|
-
export declare const add: (distance: number, range: Range) => Range;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a range such that `range` is constrained to the start and end points
|
|
27
|
-
* of `to`. The function will try to maintain the length of the range, but will
|
|
28
|
-
* shrink the range if its length is greater than `to`.
|
|
29
|
-
*/
|
|
30
|
-
export declare const constrain: (range: Range, to: Range) => Range;
|
|
31
|
-
/**
|
|
32
|
-
* Checks if the given number or range is contained within another range.
|
|
33
|
-
*/
|
|
34
|
-
export declare const contains: (numOrRange: number | Range, range: Range) => boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Returns a range that represents the overlap between `other` and `range`. If
|
|
37
|
-
* the two ranges do not intersect, then `undefined` is returned.
|
|
38
|
-
* @param other
|
|
39
|
-
* @param range
|
|
40
|
-
*/
|
|
41
|
-
export declare const intersection: (other: Range, range: Range) => Range | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Returns `true` if `other` intersects with `range`.
|
|
44
|
-
*/
|
|
45
|
-
export declare const intersects: (other: Range, range: Range) => boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Checks if a range has the same starting point as another range.
|
|
48
|
-
*/
|
|
49
|
-
export declare const isAt: (other: Range, range: Range) => boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Returns `true` if a range's start point is after the starting point of
|
|
52
|
-
* another range.
|
|
53
|
-
*/
|
|
54
|
-
export declare const isAfter: (other: Range, range: Range) => boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Returns `true` if a range start at or is after another range.
|
|
57
|
-
*/
|
|
58
|
-
export declare const isAtOrAfter: (other: Range, range: Range) => boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Returns `true` if a range's starting point is before another range's starting
|
|
61
|
-
* point.
|
|
62
|
-
*/
|
|
63
|
-
export declare const isBefore: (other: Range, range: Range) => boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Returns `true` if a range's starting point is at or before another range's
|
|
66
|
-
* starting point.
|
|
67
|
-
*/
|
|
68
|
-
export declare const isAtOrBefore: (other: Range, range: Range) => boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Returns the length of a range.
|
|
71
|
-
*/
|
|
72
|
-
export declare const length: (range: Range) => number;
|
|
73
|
-
/**
|
|
74
|
-
* Returns a `Range` with its start and end points subtracted by the given
|
|
75
|
-
* distance.
|
|
76
|
-
*/
|
|
77
|
-
export declare const subtract: (distance: number, range: Range) => Range;
|
|
78
|
-
/**
|
|
79
|
-
* Adjusts either the start or end position of a range so that its contained
|
|
80
|
-
* within another range. Unlike `constrain`, this will not attempt to retain
|
|
81
|
-
* the range's length.
|
|
82
|
-
*
|
|
83
|
-
* If `other` does not intersect with `to`, then the range cannot be truncated
|
|
84
|
-
* and `undefined` is returned.
|
|
85
|
-
*/
|
|
86
|
-
export declare const truncate: (other: Range, to: Range) => Range | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* A `Range` represents a sequence of numbers from a starting point to ending
|
|
3
|
+
* point.
|
|
4
|
+
*/
|
|
5
|
+
export interface Range {
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns a new `Range` with the given start and end points.
|
|
11
|
+
*/
|
|
12
|
+
export declare const create: (start: number, end: number) => Range;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a new `Range` with the start and end points at the given position.
|
|
15
|
+
*/
|
|
16
|
+
export declare const at: (position: number) => Range;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a new `Range` with the given start point and length.
|
|
19
|
+
*/
|
|
20
|
+
export declare const withLength: (start: number, len: number) => Range;
|
|
21
|
+
/**
|
|
22
|
+
* Returns a range with the start and end points shifted by the given distance.
|
|
23
|
+
*/
|
|
24
|
+
export declare const add: (distance: number, range: Range) => Range;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a range such that `range` is constrained to the start and end points
|
|
27
|
+
* of `to`. The function will try to maintain the length of the range, but will
|
|
28
|
+
* shrink the range if its length is greater than `to`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const constrain: (range: Range, to: Range) => Range;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the given number or range is contained within another range.
|
|
33
|
+
*/
|
|
34
|
+
export declare const contains: (numOrRange: number | Range, range: Range) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Returns a range that represents the overlap between `other` and `range`. If
|
|
37
|
+
* the two ranges do not intersect, then `undefined` is returned.
|
|
38
|
+
* @param other
|
|
39
|
+
* @param range
|
|
40
|
+
*/
|
|
41
|
+
export declare const intersection: (other: Range, range: Range) => Range | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Returns `true` if `other` intersects with `range`.
|
|
44
|
+
*/
|
|
45
|
+
export declare const intersects: (other: Range, range: Range) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a range has the same starting point as another range.
|
|
48
|
+
*/
|
|
49
|
+
export declare const isAt: (other: Range, range: Range) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Returns `true` if a range's start point is after the starting point of
|
|
52
|
+
* another range.
|
|
53
|
+
*/
|
|
54
|
+
export declare const isAfter: (other: Range, range: Range) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Returns `true` if a range start at or is after another range.
|
|
57
|
+
*/
|
|
58
|
+
export declare const isAtOrAfter: (other: Range, range: Range) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Returns `true` if a range's starting point is before another range's starting
|
|
61
|
+
* point.
|
|
62
|
+
*/
|
|
63
|
+
export declare const isBefore: (other: Range, range: Range) => boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Returns `true` if a range's starting point is at or before another range's
|
|
66
|
+
* starting point.
|
|
67
|
+
*/
|
|
68
|
+
export declare const isAtOrBefore: (other: Range, range: Range) => boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the length of a range.
|
|
71
|
+
*/
|
|
72
|
+
export declare const length: (range: Range) => number;
|
|
73
|
+
/**
|
|
74
|
+
* Returns a `Range` with its start and end points subtracted by the given
|
|
75
|
+
* distance.
|
|
76
|
+
*/
|
|
77
|
+
export declare const subtract: (distance: number, range: Range) => Range;
|
|
78
|
+
/**
|
|
79
|
+
* Adjusts either the start or end position of a range so that its contained
|
|
80
|
+
* within another range. Unlike `constrain`, this will not attempt to retain
|
|
81
|
+
* the range's length.
|
|
82
|
+
*
|
|
83
|
+
* If `other` does not intersect with `to`, then the range cannot be truncated
|
|
84
|
+
* and `undefined` is returned.
|
|
85
|
+
*/
|
|
86
|
+
export declare const truncate: (other: Range, to: Range) => Range | undefined;
|
package/dist/sets.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function diffSet<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
1
|
+
export declare function diffSet<T>(a: Set<T>, b: Set<T>): Set<T>;
|
package/dist/sort.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A `Comparator` defines a function that computes the order of two values.
|
|
3
|
-
*/
|
|
4
|
-
export
|
|
5
|
-
/**
|
|
6
|
-
* A comparator that sorts a number or string in ascending order.
|
|
7
|
-
*/
|
|
8
|
-
export declare const asc: (a: number | string, b: number | string) => number;
|
|
9
|
-
/**
|
|
10
|
-
* A comparator that sorts a number or string in descending order.
|
|
11
|
-
*/
|
|
12
|
-
export declare const desc: (a: number | string, b: number | string) => number;
|
|
13
|
-
/**
|
|
14
|
-
* A comparator that reverses the sort order of another comparator.
|
|
15
|
-
*/
|
|
16
|
-
export declare const reverse: <T>(comparator: Comparator<T>) => Comparator<T>;
|
|
17
|
-
/**
|
|
18
|
-
* A comparator that plucks the first element of an array and passes that value
|
|
19
|
-
* to the given comparator for sorting.
|
|
20
|
-
*/
|
|
21
|
-
export declare const head: <T>(comparator: Comparator<T>) => Comparator<T[]>;
|
|
1
|
+
/**
|
|
2
|
+
* A `Comparator` defines a function that computes the order of two values.
|
|
3
|
+
*/
|
|
4
|
+
export type Comparator<T> = (a: T, b: T) => number;
|
|
5
|
+
/**
|
|
6
|
+
* A comparator that sorts a number or string in ascending order.
|
|
7
|
+
*/
|
|
8
|
+
export declare const asc: (a: number | string, b: number | string) => number;
|
|
9
|
+
/**
|
|
10
|
+
* A comparator that sorts a number or string in descending order.
|
|
11
|
+
*/
|
|
12
|
+
export declare const desc: (a: number | string, b: number | string) => number;
|
|
13
|
+
/**
|
|
14
|
+
* A comparator that reverses the sort order of another comparator.
|
|
15
|
+
*/
|
|
16
|
+
export declare const reverse: <T>(comparator: Comparator<T>) => Comparator<T>;
|
|
17
|
+
/**
|
|
18
|
+
* A comparator that plucks the first element of an array and passes that value
|
|
19
|
+
* to the given comparator for sorting.
|
|
20
|
+
*/
|
|
21
|
+
export declare const head: <T>(comparator: Comparator<T>) => Comparator<T[]>;
|
package/dist/strings.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function trimStart(str: string): string;
|
|
2
|
-
export declare function trimEnd(str: string): string;
|
|
3
|
-
export declare function trim(str: string): string;
|
|
1
|
+
export declare function trimStart(str: string): string;
|
|
2
|
+
export declare function trimEnd(str: string): string;
|
|
3
|
+
export declare function trim(str: string): string;
|
package/dist/uri.d.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A type that represents a Uniform Resource Identifier (URI).
|
|
3
|
-
*/
|
|
4
|
-
export interface Uri {
|
|
5
|
-
scheme?: string;
|
|
6
|
-
authority?: string;
|
|
7
|
-
path?: string;
|
|
8
|
-
query?: string;
|
|
9
|
-
fragment?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Parses a URI string according to RFC 3986. If the URI is an empty string,
|
|
15
|
-
* then an empty object is returned.
|
|
16
|
-
*
|
|
17
|
-
* See https://tools.ietf.org/html/rfc3986#appendix-B for parsing rules.
|
|
18
|
-
*
|
|
19
|
-
* @param uri The URI to parse.
|
|
20
|
-
*/
|
|
21
|
-
export declare const parse: (uri: string) => Uri;
|
|
22
|
-
/**
|
|
23
|
-
* Convenience method to create a URI from a base string and add params if present
|
|
24
|
-
* @param base
|
|
25
|
-
* @param params
|
|
26
|
-
*/
|
|
27
|
-
export declare const parseAndAddParams: (baseStr: string, params?: Record<string, unknown>
|
|
28
|
-
export declare const isEqual: (a: Uri, b: Uri) => boolean;
|
|
29
|
-
export declare const replacePath: (path: string, uri: Uri) => Uri;
|
|
30
|
-
export declare const pathAsArray: (uri: Uri) => string[];
|
|
31
|
-
export declare const appendPath: (path: string, uri: Uri) => Uri;
|
|
32
|
-
export declare const addQueryString: (query: string, uri: Uri) => Uri;
|
|
33
|
-
export declare const addQueryEntry: (query: QueryEntry, uri: Uri) => Uri;
|
|
34
|
-
export declare const addQueryEntries: (entries: QueryEntry[], uri: Uri) => Uri;
|
|
35
|
-
export declare const addQueryParams: (params: Record<string, any>, uri: Uri) => Uri;
|
|
36
|
-
export declare const replaceFragment: (fragment: string, uri: Uri) => Uri;
|
|
37
|
-
/**
|
|
38
|
-
* Return an array of name/value pairs representing the query string of a URI.
|
|
39
|
-
* The returned names and values will be URI decoded. If the query string is
|
|
40
|
-
* empty, then an empty array is returned.
|
|
41
|
-
*
|
|
42
|
-
* @param uri A URI to return the query string for.
|
|
43
|
-
*/
|
|
44
|
-
export declare const queryAsArray: (uri: Uri) => QueryEntry[];
|
|
45
|
-
/**
|
|
46
|
-
* Return a map containing a URI's query string names and their values. The
|
|
47
|
-
* returned names and values will be URI decoded. If the query string contains
|
|
48
|
-
* multiple instances of the same name, then the last occurrence will be used.
|
|
49
|
-
*
|
|
50
|
-
* If the query string is empty, an empty map is returned.
|
|
51
|
-
*
|
|
52
|
-
* @param uri A URI to return the query string for.
|
|
53
|
-
*/
|
|
54
|
-
export declare const queryAsMap: (uri: Uri) => QueryMap;
|
|
55
|
-
export declare const toString: (uri: Uri) => string;
|
|
56
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* A type that represents a Uniform Resource Identifier (URI).
|
|
3
|
+
*/
|
|
4
|
+
export interface Uri {
|
|
5
|
+
scheme?: string;
|
|
6
|
+
authority?: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
query?: string;
|
|
9
|
+
fragment?: string;
|
|
10
|
+
}
|
|
11
|
+
type QueryMap = Record<string, string>;
|
|
12
|
+
type QueryEntry = [string, string];
|
|
13
|
+
/**
|
|
14
|
+
* Parses a URI string according to RFC 3986. If the URI is an empty string,
|
|
15
|
+
* then an empty object is returned.
|
|
16
|
+
*
|
|
17
|
+
* See https://tools.ietf.org/html/rfc3986#appendix-B for parsing rules.
|
|
18
|
+
*
|
|
19
|
+
* @param uri The URI to parse.
|
|
20
|
+
*/
|
|
21
|
+
export declare const parse: (uri: string) => Uri;
|
|
22
|
+
/**
|
|
23
|
+
* Convenience method to create a URI from a base string and add params if present
|
|
24
|
+
* @param base
|
|
25
|
+
* @param params
|
|
26
|
+
*/
|
|
27
|
+
export declare const parseAndAddParams: (baseStr: string, params?: Record<string, unknown>) => Uri;
|
|
28
|
+
export declare const isEqual: (a: Uri, b: Uri) => boolean;
|
|
29
|
+
export declare const replacePath: (path: string, uri: Uri) => Uri;
|
|
30
|
+
export declare const pathAsArray: (uri: Uri) => string[];
|
|
31
|
+
export declare const appendPath: (path: string, uri: Uri) => Uri;
|
|
32
|
+
export declare const addQueryString: (query: string, uri: Uri) => Uri;
|
|
33
|
+
export declare const addQueryEntry: (query: QueryEntry, uri: Uri) => Uri;
|
|
34
|
+
export declare const addQueryEntries: (entries: QueryEntry[], uri: Uri) => Uri;
|
|
35
|
+
export declare const addQueryParams: (params: Record<string, any>, uri: Uri) => Uri;
|
|
36
|
+
export declare const replaceFragment: (fragment: string, uri: Uri) => Uri;
|
|
37
|
+
/**
|
|
38
|
+
* Return an array of name/value pairs representing the query string of a URI.
|
|
39
|
+
* The returned names and values will be URI decoded. If the query string is
|
|
40
|
+
* empty, then an empty array is returned.
|
|
41
|
+
*
|
|
42
|
+
* @param uri A URI to return the query string for.
|
|
43
|
+
*/
|
|
44
|
+
export declare const queryAsArray: (uri: Uri) => QueryEntry[];
|
|
45
|
+
/**
|
|
46
|
+
* Return a map containing a URI's query string names and their values. The
|
|
47
|
+
* returned names and values will be URI decoded. If the query string contains
|
|
48
|
+
* multiple instances of the same name, then the last occurrence will be used.
|
|
49
|
+
*
|
|
50
|
+
* If the query string is empty, an empty map is returned.
|
|
51
|
+
*
|
|
52
|
+
* @param uri A URI to return the query string for.
|
|
53
|
+
*/
|
|
54
|
+
export declare const queryAsMap: (uri: Uri) => QueryMap;
|
|
55
|
+
export declare const toString: (uri: Uri) => string;
|
|
56
|
+
export {};
|
package/dist/uuid.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export interface UUIDMsbLsb {
|
|
3
|
-
msb: string;
|
|
4
|
-
lsb: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function create(): UUID;
|
|
7
|
-
export declare function fromMsbLsb(msb: bigint | string, lsb: bigint | string): UUID;
|
|
8
|
-
export declare function toMsbLsb(id: UUID): UUIDMsbLsb;
|
|
1
|
+
export type UUID = string;
|
|
2
|
+
export interface UUIDMsbLsb {
|
|
3
|
+
msb: string;
|
|
4
|
+
lsb: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function create(): UUID;
|
|
7
|
+
export declare function fromMsbLsb(msb: bigint | string, lsb: bigint | string): UUID;
|
|
8
|
+
export declare function toMsbLsb(id: UUID): UUIDMsbLsb;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertexvis/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-testing.0",
|
|
4
4
|
"description": "Utility library for Viewer SDK.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vertex Developers <support@vertexvis.com> (https://developer.vertexvis.com)",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"format": "yarn lint --fix",
|
|
33
33
|
"lint": "eslint --ext .ts,.tsx,.js,.jsx --ignore-path ../../.gitignore .",
|
|
34
34
|
"start": "jest --watch",
|
|
35
|
-
"test": "jest",
|
|
35
|
+
"test": "jest --runInBand",
|
|
36
36
|
"test:ci": "yarn test:coverage",
|
|
37
37
|
"test:coverage": "yarn test --coverage"
|
|
38
38
|
},
|
|
@@ -42,21 +42,21 @@
|
|
|
42
42
|
"uuid": "^8.3.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/jest": "^
|
|
45
|
+
"@types/jest": "^29.5.14",
|
|
46
46
|
"@types/uuid": "^8.3.4",
|
|
47
47
|
"@vertexvis/eslint-config-vertexvis-typescript": "^0.5.0",
|
|
48
48
|
"@vertexvis/jest-config-vertexvis": "^0.5.4",
|
|
49
|
-
"@vertexwebsdk/build": "0.
|
|
49
|
+
"@vertexwebsdk/build": "1.0.0-testing.0",
|
|
50
50
|
"eslint": "^8.57.1",
|
|
51
|
-
"jest": "^
|
|
52
|
-
"jest-cli": "^
|
|
51
|
+
"jest": "^29.5.14",
|
|
52
|
+
"jest-cli": "^29.5.14",
|
|
53
53
|
"rollup": "^2.80.0",
|
|
54
|
-
"ts-jest": "^
|
|
55
|
-
"tslib": "^2.
|
|
56
|
-
"typescript": "^
|
|
54
|
+
"ts-jest": "^29.4.9",
|
|
55
|
+
"tslib": "^2.4.0",
|
|
56
|
+
"typescript": "^5.2.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"tslib": ">=2.
|
|
59
|
+
"tslib": ">=2.4.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "af7f83bc7fb28fc64aafd516685ed55b745805a0"
|
|
62
62
|
}
|