@steedos/odata-v4-parser 2.5.3-beta.2 → 2.5.3-beta.21
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/package.json +2 -2
- package/src/json.ts +371 -371
- package/src/nameOrIdentifier.ts +748 -748
- package/src/odataUri.ts +37 -37
- package/src/primitiveLiteral.ts +684 -684
- package/src/resourcePath.ts +461 -461
- package/src/utils.ts +36 -36
package/src/utils.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
export namespace Utils {
|
|
2
|
-
export type SourceArray = number[] | Uint16Array;
|
|
3
|
-
|
|
4
|
-
export function stringify(value: SourceArray, index: number, next: number): string {
|
|
5
|
-
return Array.prototype.map.call(value.slice(index, next), function (ch) { return String.fromCharCode(ch); }).join("");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function is(value: number, compare: string) {
|
|
9
|
-
for (let i = 0; i < compare.length; i++) {
|
|
10
|
-
if (value === compare.charCodeAt(i)) return true;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function equals(value: SourceArray, index: number, compare: string) {
|
|
17
|
-
let i = 0;
|
|
18
|
-
while (value[index + i] === compare.charCodeAt(i) && i < compare.length) {
|
|
19
|
-
i++;
|
|
20
|
-
}
|
|
21
|
-
return i === compare.length ? i : 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function required(value: SourceArray, index: number, comparer: Function, min?: number, max?: number) {
|
|
25
|
-
let i = 0;
|
|
26
|
-
|
|
27
|
-
max = max || (value.length - index);
|
|
28
|
-
while (i < max && comparer(value[index + i])) {
|
|
29
|
-
i++;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return i >= (min || 0) && i <= max ? index + i : 0;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default Utils;
|
|
1
|
+
export namespace Utils {
|
|
2
|
+
export type SourceArray = number[] | Uint16Array;
|
|
3
|
+
|
|
4
|
+
export function stringify(value: SourceArray, index: number, next: number): string {
|
|
5
|
+
return Array.prototype.map.call(value.slice(index, next), function (ch) { return String.fromCharCode(ch); }).join("");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function is(value: number, compare: string) {
|
|
9
|
+
for (let i = 0; i < compare.length; i++) {
|
|
10
|
+
if (value === compare.charCodeAt(i)) return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function equals(value: SourceArray, index: number, compare: string) {
|
|
17
|
+
let i = 0;
|
|
18
|
+
while (value[index + i] === compare.charCodeAt(i) && i < compare.length) {
|
|
19
|
+
i++;
|
|
20
|
+
}
|
|
21
|
+
return i === compare.length ? i : 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function required(value: SourceArray, index: number, comparer: Function, min?: number, max?: number) {
|
|
25
|
+
let i = 0;
|
|
26
|
+
|
|
27
|
+
max = max || (value.length - index);
|
|
28
|
+
while (i < max && comparer(value[index + i])) {
|
|
29
|
+
i++;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return i >= (min || 0) && i <= max ? index + i : 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default Utils;
|