bc-minecraft-bedrock-types 1.22.1-12 → 1.22.1-13
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.
|
@@ -12,12 +12,8 @@ export type TextOrDoc = string | {
|
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
14
|
export declare namespace DocumentLocation {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @param data
|
|
18
|
-
* @param text
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
15
|
+
function toOffset(data: number): number;
|
|
16
|
+
function toOffset(data: OffsetWord): number;
|
|
21
17
|
function toOffset(data: DocumentLocation, text: TextOrDoc): number;
|
|
22
18
|
/**TODO add documentation
|
|
23
19
|
*
|
|
@@ -26,12 +22,6 @@ export declare namespace DocumentLocation {
|
|
|
26
22
|
* @returns
|
|
27
23
|
*/
|
|
28
24
|
function toPosition(data: DocumentLocation, text: TextOrDoc): Position;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* @param data
|
|
32
|
-
* @param text
|
|
33
|
-
* @param length
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
function ToRange(data: DocumentLocation, text: TextOrDoc, length: number): Range;
|
|
25
|
+
function toRange(data: OffsetWord): Range;
|
|
26
|
+
function toRange(data: DocumentLocation, text: TextOrDoc, length: number): Range;
|
|
37
27
|
}
|
|
@@ -13,24 +13,22 @@ function ToText(value) {
|
|
|
13
13
|
*/
|
|
14
14
|
var DocumentLocation;
|
|
15
15
|
(function (DocumentLocation) {
|
|
16
|
-
/**TODO add documentation
|
|
17
|
-
*
|
|
18
|
-
* @param data
|
|
19
|
-
* @param text
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
16
|
function toOffset(data, text) {
|
|
23
17
|
switch (typeof data) {
|
|
24
18
|
case "number":
|
|
25
19
|
return data;
|
|
26
20
|
//Json path
|
|
27
21
|
case "string":
|
|
22
|
+
if (text === undefined)
|
|
23
|
+
throw new Error("text or document must be provided");
|
|
28
24
|
return json_path_1.JsonPath.resolve(text, data);
|
|
29
25
|
//Position
|
|
30
26
|
case "object":
|
|
31
27
|
if (offset_word_1.OffsetWord.is(data)) {
|
|
32
28
|
return data.offset;
|
|
33
29
|
}
|
|
30
|
+
if (text === undefined)
|
|
31
|
+
throw new Error("text or document must be provided");
|
|
34
32
|
return position_1.Position.toOffset(data, ToText(text));
|
|
35
33
|
default:
|
|
36
34
|
return 0;
|
|
@@ -61,23 +59,20 @@ var DocumentLocation;
|
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
61
|
DocumentLocation.toPosition = toPosition;
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
* @param data
|
|
67
|
-
* @param text
|
|
68
|
-
* @param length
|
|
69
|
-
* @returns
|
|
70
|
-
*/
|
|
71
|
-
function ToRange(data, text, length) {
|
|
62
|
+
function toRange(data, text, length) {
|
|
72
63
|
if (offset_word_1.OffsetWord.is(data)) {
|
|
73
64
|
const t = data.text;
|
|
74
65
|
return range_1.Range.create(position_1.Position.toPosition(data.offset, t), position_1.Position.toPosition(data.offset + t.length, t));
|
|
75
66
|
}
|
|
67
|
+
if (text === undefined)
|
|
68
|
+
throw new Error("requires text or document");
|
|
69
|
+
if (length === undefined)
|
|
70
|
+
throw new Error("requires length");
|
|
76
71
|
const startindex = toOffset(data, text);
|
|
77
72
|
const endindex = startindex + length;
|
|
78
73
|
const t = ToText(text);
|
|
79
74
|
return range_1.Range.create(position_1.Position.toPosition(startindex, t), position_1.Position.toPosition(endindex, t));
|
|
80
75
|
}
|
|
81
|
-
DocumentLocation.
|
|
76
|
+
DocumentLocation.toRange = toRange;
|
|
82
77
|
})(DocumentLocation || (exports.DocumentLocation = DocumentLocation = {}));
|
|
83
78
|
//# sourceMappingURL=document-location.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-location.js","sourceRoot":"","sources":["../../src/types/document-location.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAC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