@speleotica/frcsdata 5.0.0-beta.3 → 5.0.0-beta.5
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/cli/{check-survey-correspondence.d.ts → check-correspondence.d.ts} +1 -1
- package/cli/check-correspondence.d.ts.map +1 -0
- package/cli/{check-survey-correspondence.js → check-correspondence.js} +4 -5
- package/cli/check-correspondence.js.map +1 -0
- package/cli/{check-survey.d.ts → check.d.ts} +1 -1
- package/cli/check.d.ts.map +1 -0
- package/cli/{check-survey.js → check.js} +3 -3
- package/cli/check.js.map +1 -0
- package/cli/compareNames.d.ts +2 -0
- package/cli/compareNames.d.ts.map +1 -0
- package/cli/compareNames.js +15 -0
- package/cli/compareNames.js.map +1 -0
- package/cli/formatNamesFile.d.ts +4 -0
- package/cli/formatNamesFile.d.ts.map +1 -0
- package/cli/formatNamesFile.js +13 -0
- package/cli/formatNamesFile.js.map +1 -0
- package/cli/list-names.d.ts +5 -0
- package/cli/list-names.d.ts.map +1 -0
- package/cli/list-names.js +74 -0
- package/cli/list-names.js.map +1 -0
- package/cli/merge-names-files.d.ts +2 -0
- package/cli/merge-names-files.d.ts.map +1 -0
- package/cli/merge-names-files.js +25 -0
- package/cli/merge-names-files.js.map +1 -0
- package/cli/parse-survey.d.ts.map +1 -1
- package/cli/parse-survey.js +3 -2
- package/cli/parse-survey.js.map +1 -1
- package/cli/parseNamesFile.d.ts +4 -0
- package/cli/parseNamesFile.d.ts.map +1 -0
- package/cli/parseNamesFile.js +19 -0
- package/cli/parseNamesFile.js.map +1 -0
- package/cli/readFile.d.ts +2 -0
- package/cli/readFile.d.ts.map +1 -0
- package/cli/readFile.js +13 -0
- package/cli/readFile.js.map +1 -0
- package/cli/replace-names.d.ts +2 -0
- package/cli/replace-names.d.ts.map +1 -0
- package/cli/replace-names.js +45 -0
- package/cli/replace-names.js.map +1 -0
- package/cli/{summarize-survey.d.ts → summarize.d.ts} +1 -1
- package/cli/summarize.d.ts.map +1 -0
- package/cli/{summarize-survey.js → summarize.js} +3 -3
- package/cli/summarize.js.map +1 -0
- package/cli.js +72 -7
- package/cli.js.map +1 -1
- package/index.d.ts +8 -6
- package/index.d.ts.map +1 -1
- package/index.js +7 -28
- package/index.js.map +1 -1
- package/node/index.d.ts +1 -1
- package/node/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/replaceRanges.d.ts +6 -0
- package/replaceRanges.d.ts.map +1 -0
- package/replaceRanges.js +23 -0
- package/replaceRanges.js.map +1 -0
- package/src/cli/{check-survey-correspondence.ts → check-correspondence.ts} +6 -5
- package/src/cli/{check-survey.ts → check.ts} +2 -2
- package/src/cli/compareNames.ts +13 -0
- package/src/cli/formatNamesFile.ts +13 -0
- package/src/cli/list-names.ts +94 -0
- package/src/cli/merge-names-files.ts +18 -0
- package/src/cli/parse-survey.ts +3 -2
- package/src/cli/parseNamesFile.ts +10 -0
- package/src/cli/readFile.ts +6 -0
- package/src/cli/replace-names.ts +41 -0
- package/src/cli/{summarize-survey.ts → summarize.ts} +2 -2
- package/src/cli.ts +67 -7
- package/src/index.ts +22 -7
- package/src/replaceRanges.ts +21 -0
- package/src/survey/FrcsSurveyFile.ts +1 -0
- package/src/survey/ZodFrcsSurveyFileJson.ts +1 -0
- package/src/survey/normalizeTeamMemberName.ts +15 -3
- package/src/survey/parseFrcsSurveyFile.ts +210 -9
- package/string/index.d.ts +1 -1
- package/string/index.d.ts.map +1 -1
- package/survey/FrcsSurveyFile.d.ts +1 -0
- package/survey/FrcsSurveyFile.d.ts.map +1 -1
- package/survey/FrcsSurveyFile.js.map +1 -1
- package/survey/ZodFrcsSurveyFileJson.d.ts +283 -280
- package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -1
- package/survey/ZodFrcsSurveyFileJson.js +2 -1
- package/survey/ZodFrcsSurveyFileJson.js.map +1 -1
- package/survey/ZodFrcsSurveyFileToJson.d.ts +280 -280
- package/survey/normalizeTeamMemberName.d.ts +1 -0
- package/survey/normalizeTeamMemberName.d.ts.map +1 -1
- package/survey/normalizeTeamMemberName.js +11 -1
- package/survey/normalizeTeamMemberName.js.map +1 -1
- package/survey/parseFrcsSurveyFile.d.ts +1 -1
- package/survey/parseFrcsSurveyFile.d.ts.map +1 -1
- package/survey/parseFrcsSurveyFile.js +140 -13
- package/survey/parseFrcsSurveyFile.js.map +1 -1
- package/cli/check-survey-correspondence.d.ts.map +0 -1
- package/cli/check-survey-correspondence.js.map +0 -1
- package/cli/check-survey.d.ts.map +0 -1
- package/cli/check-survey.js.map +0 -1
- package/cli/summarize-survey.d.ts.map +0 -1
- package/cli/summarize-survey.js.map +0 -1
package/src/index.ts
CHANGED
|
@@ -3,29 +3,44 @@ import type {
|
|
|
3
3
|
FrcsSurveyFile,
|
|
4
4
|
FrcsTrip,
|
|
5
5
|
FrcsTripHeader,
|
|
6
|
+
InvalidFrcsShot,
|
|
7
|
+
InvalidFrcsSurveyFile,
|
|
8
|
+
InvalidFrcsTrip,
|
|
9
|
+
InvalidFrcsTripHeader,
|
|
10
|
+
InvalidFrcsUnits,
|
|
6
11
|
} from './survey/FrcsSurveyFile'
|
|
7
12
|
import parseFrcsSurveyFile from './survey/parseFrcsSurveyFile'
|
|
8
|
-
import { FrcsPlotShot } from './FrcsPlotShot'
|
|
9
|
-
import { FrcsPlotFile } from './FrcsPlotFile'
|
|
13
|
+
import type { FrcsPlotShot } from './FrcsPlotShot'
|
|
14
|
+
import type { FrcsPlotFile } from './FrcsPlotFile'
|
|
10
15
|
import parseFrcsPlotFile from './parseFrcsPlotFile'
|
|
11
|
-
import { FrcsTripSummary } from './FrcsTripSummary'
|
|
12
|
-
import { FrcsTripSummaryFile } from './FrcsTripSummaryFile'
|
|
16
|
+
import type { FrcsTripSummary } from './FrcsTripSummary'
|
|
17
|
+
import { type FrcsTripSummaryFile } from './FrcsTripSummaryFile'
|
|
13
18
|
import parseFrcsTripSummaryFile from './parseFrcsTripSummaryFile'
|
|
14
19
|
import formatFrcsShot from './survey/formatFrcsShot'
|
|
15
20
|
import { formatFrcsSurveyFile } from './survey/formatFrcsSurveyFile'
|
|
21
|
+
import { formatIssues } from './formatIssues'
|
|
16
22
|
|
|
17
|
-
export {
|
|
23
|
+
export type {
|
|
18
24
|
FrcsShot,
|
|
19
25
|
FrcsSurveyFile,
|
|
20
26
|
FrcsTrip,
|
|
21
27
|
FrcsTripHeader,
|
|
22
|
-
|
|
28
|
+
InvalidFrcsShot,
|
|
29
|
+
InvalidFrcsSurveyFile,
|
|
30
|
+
InvalidFrcsTrip,
|
|
31
|
+
InvalidFrcsTripHeader,
|
|
32
|
+
InvalidFrcsUnits,
|
|
23
33
|
FrcsPlotShot,
|
|
24
34
|
FrcsPlotFile,
|
|
25
|
-
parseFrcsPlotFile,
|
|
26
35
|
FrcsTripSummary,
|
|
27
36
|
FrcsTripSummaryFile,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
parseFrcsSurveyFile,
|
|
41
|
+
parseFrcsPlotFile,
|
|
28
42
|
parseFrcsTripSummaryFile,
|
|
29
43
|
formatFrcsShot,
|
|
30
44
|
formatFrcsSurveyFile,
|
|
45
|
+
formatIssues,
|
|
31
46
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function replaceRanges(
|
|
2
|
+
source: string,
|
|
3
|
+
replacements: { start: number; end: number; value: string }[]
|
|
4
|
+
): string {
|
|
5
|
+
replacements.sort((a, b) => a.start - b.start)
|
|
6
|
+
|
|
7
|
+
const parts = []
|
|
8
|
+
let end = 0
|
|
9
|
+
for (const r of replacements) {
|
|
10
|
+
if (r.start > end) {
|
|
11
|
+
parts.push(source.substring(end, r.start))
|
|
12
|
+
}
|
|
13
|
+
parts.push(r.value)
|
|
14
|
+
end = r.end
|
|
15
|
+
}
|
|
16
|
+
if (end < source.length) {
|
|
17
|
+
parts.push(source.substring(end))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return parts.join('')
|
|
21
|
+
}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
export function normalizeTeamMemberName(name: string) {
|
|
2
|
-
name = name
|
|
3
|
-
match.toUpperCase() === match ? `${head}${tail.toLowerCase()}` : match
|
|
4
|
-
)
|
|
2
|
+
name = normalizeNameCapitalization(name)
|
|
5
3
|
name = name.replace(/_/g, ' ')
|
|
6
4
|
return name
|
|
7
5
|
}
|
|
6
|
+
|
|
7
|
+
export function normalizeNameCapitalization(name: string) {
|
|
8
|
+
return name.replace(/([^. _]+)/g, (match) => {
|
|
9
|
+
if (match.toUpperCase() !== match) return match
|
|
10
|
+
if (/^(mc|.')/i.test(match)) {
|
|
11
|
+
return (
|
|
12
|
+
match.substring(0, 2) +
|
|
13
|
+
match[2].toUpperCase() +
|
|
14
|
+
match.substring(3).toLowerCase()
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
return match[0] + match.substring(1).toLowerCase()
|
|
18
|
+
})
|
|
19
|
+
}
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
InvalidFrcsUnits,
|
|
10
10
|
InvalidFrcsTrip,
|
|
11
11
|
InvalidFrcsShot,
|
|
12
|
+
FrcsTripHeader,
|
|
12
13
|
} from './FrcsSurveyFile'
|
|
13
14
|
import { Angle, Length, UnitizedNumber, Unitize } from '@speleotica/unitized'
|
|
14
15
|
import { ParseIssue, ParseIssueSeverity } from '../ParseIssue'
|
|
@@ -34,6 +35,7 @@ import {
|
|
|
34
35
|
} from './parsers'
|
|
35
36
|
import { normalizeTeamMemberName } from './normalizeTeamMemberName'
|
|
36
37
|
import { unwrapInvalid } from '../unwrapInvalid'
|
|
38
|
+
import { SourceLoc } from '../SourceLoc'
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* Parses a raw cdata.fr survey file. These look like so:
|
|
@@ -88,6 +90,7 @@ export default async function parseFrcsSurveyFile(
|
|
|
88
90
|
outputColumns = false,
|
|
89
91
|
normalizeNames = true,
|
|
90
92
|
suppressWarnings,
|
|
93
|
+
includeLocs,
|
|
91
94
|
}: ParseFrcsSurveyFileOptions = {}
|
|
92
95
|
): Promise<FrcsSurveyFile | InvalidFrcsSurveyFile> {
|
|
93
96
|
const columnRanges = getColumnRanges(columns)
|
|
@@ -98,11 +101,15 @@ export default async function parseFrcsSurveyFile(
|
|
|
98
101
|
let cave: string | undefined = undefined
|
|
99
102
|
let location: string | undefined = undefined
|
|
100
103
|
const trips: (FrcsTrip | InvalidFrcsTrip)[] = []
|
|
104
|
+
const rootLocs: FrcsSurveyFile['locs'] = {}
|
|
101
105
|
const issues: ParseIssue[] = []
|
|
102
106
|
|
|
103
107
|
let tripName: string | undefined
|
|
108
|
+
let tripNameLoc: SourceLoc | undefined
|
|
104
109
|
let tripTeam: string[] | undefined
|
|
110
|
+
let tripTeamLoc: SourceLoc[] | undefined
|
|
105
111
|
let tripDate: Date | undefined
|
|
112
|
+
let tripDateLoc: SourceLoc | undefined
|
|
106
113
|
let inTripComment = true
|
|
107
114
|
let tripCommentStartLine = 1
|
|
108
115
|
let tripCommentEndLine = -1
|
|
@@ -111,6 +118,7 @@ export default async function parseFrcsSurveyFile(
|
|
|
111
118
|
let trip: FrcsTrip | InvalidFrcsTrip | undefined = undefined
|
|
112
119
|
let inBlockComment = false
|
|
113
120
|
let section
|
|
121
|
+
let sectionLoc: SourceLoc | undefined
|
|
114
122
|
const commentFromStationLruds = new Map<
|
|
115
123
|
string,
|
|
116
124
|
NonNullable<FrcsShot['fromLruds']>
|
|
@@ -139,11 +147,25 @@ export default async function parseFrcsSurveyFile(
|
|
|
139
147
|
if (/^\s+\*/.test(line)) {
|
|
140
148
|
continue
|
|
141
149
|
}
|
|
142
|
-
const match = /^\s*([^,]+)(,(.*))
|
|
150
|
+
const match = /^\s*([^,]+)(,(.*))?/d.exec(line)
|
|
143
151
|
if (match) {
|
|
144
152
|
cave = match[1].trim()
|
|
153
|
+
if (includeLocs && match.indices) {
|
|
154
|
+
rootLocs.cave = makeLineLoc(
|
|
155
|
+
lineNumber,
|
|
156
|
+
lineStartIndex,
|
|
157
|
+
...match.indices[1]
|
|
158
|
+
)
|
|
159
|
+
}
|
|
145
160
|
if (match[3]) {
|
|
146
161
|
location = match[3].trim()
|
|
162
|
+
if (includeLocs && match.indices) {
|
|
163
|
+
rootLocs.cave = makeLineLoc(
|
|
164
|
+
lineNumber,
|
|
165
|
+
lineStartIndex,
|
|
166
|
+
...match.indices[3]
|
|
167
|
+
)
|
|
168
|
+
}
|
|
147
169
|
}
|
|
148
170
|
}
|
|
149
171
|
}
|
|
@@ -157,9 +179,14 @@ export default async function parseFrcsSurveyFile(
|
|
|
157
179
|
alternateUnits = nextShotUnits = undefined
|
|
158
180
|
unitsChanged = false
|
|
159
181
|
if (inTripComment) {
|
|
182
|
+
tripName = undefined
|
|
183
|
+
tripNameLoc = undefined
|
|
160
184
|
section = undefined
|
|
185
|
+
sectionLoc = undefined
|
|
161
186
|
tripTeam = undefined
|
|
187
|
+
tripTeamLoc = undefined
|
|
162
188
|
tripDate = undefined
|
|
189
|
+
tripDateLoc = undefined
|
|
163
190
|
tripComment.length = 0
|
|
164
191
|
tripCommentStartLine = lineNumber
|
|
165
192
|
} else {
|
|
@@ -167,17 +194,49 @@ export default async function parseFrcsSurveyFile(
|
|
|
167
194
|
}
|
|
168
195
|
} else if (inTripComment) {
|
|
169
196
|
if (lineNumber === tripCommentStartLine + 1) {
|
|
170
|
-
tripName = line
|
|
197
|
+
tripName = line.trim()
|
|
198
|
+
const startColumn = /\S/.exec(line)?.index ?? 0
|
|
199
|
+
const endColumn = startColumn + tripName.length
|
|
200
|
+
tripNameLoc = makeLineLoc(
|
|
201
|
+
lineNumber,
|
|
202
|
+
lineStartIndex,
|
|
203
|
+
startColumn,
|
|
204
|
+
endColumn
|
|
205
|
+
)
|
|
171
206
|
} else if (lineNumber === tripCommentStartLine + 2) {
|
|
172
207
|
const dateMatch =
|
|
173
|
-
/(?:[-.]\s*)?((\d+)[-/](\d+)[-/](\d{2,4})|((\d+)[-/ ](january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)[-/ ](\d{2,4}))|((january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)\s+(\d+)(?:,\s*|,?\s+)(\d{2,4})))/
|
|
208
|
+
/(?:[-.]\s*)?((\d+)[-/](\d+)[-/](\d{2,4})|((\d+)[-/ ](january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)[-/ ](\d{2,4}))|((january|february|march|april|may|june|july|august|september|october|november|december|(?:jan|feb|mar|apr|jun|jul|aug|sept?|oct|nov|dec)\.?)\s+(\d+)(?:,\s*|,?\s+)(\d{2,4})))/di.exec(
|
|
174
209
|
line
|
|
175
210
|
)
|
|
176
211
|
if (dateMatch) {
|
|
177
|
-
const team = line.substring(0, dateMatch.index)
|
|
178
|
-
tripTeam =
|
|
179
|
-
|
|
180
|
-
|
|
212
|
+
const team = line.substring(0, dateMatch.index).replace(/\.?\s*$/, '')
|
|
213
|
+
tripTeam = []
|
|
214
|
+
tripTeamLoc = []
|
|
215
|
+
for (const match of team.matchAll(
|
|
216
|
+
team.includes(';')
|
|
217
|
+
? /\s*([^;]+)\s*/dg
|
|
218
|
+
: team.includes(',')
|
|
219
|
+
? /\s*([^,]+)\s*/dg
|
|
220
|
+
: team.includes('&')
|
|
221
|
+
? /\s*([^&]+)\s*/dg
|
|
222
|
+
: /\S {2,}\S/.test(team)
|
|
223
|
+
? /(\S+( \S+)*)/dg
|
|
224
|
+
: /(\S+( \S\.? )? \S{2,})/dg
|
|
225
|
+
)) {
|
|
226
|
+
const name = match[1].trim()
|
|
227
|
+
tripTeam.push(name)
|
|
228
|
+
if (includeLocs && match.indices) {
|
|
229
|
+
const index = match.indices[1][0]
|
|
230
|
+
tripTeamLoc.push(
|
|
231
|
+
makeLineLoc(
|
|
232
|
+
lineNumber,
|
|
233
|
+
lineStartIndex,
|
|
234
|
+
index,
|
|
235
|
+
index + name.length
|
|
236
|
+
)
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
181
240
|
if (!tripTeam.length) {
|
|
182
241
|
addIssue(
|
|
183
242
|
'warning',
|
|
@@ -204,6 +263,13 @@ export default async function parseFrcsSurveyFile(
|
|
|
204
263
|
year = parseInt(dateMatch[12])
|
|
205
264
|
}
|
|
206
265
|
tripDate = new Date(year < 60 ? year + 2000 : year, month - 1, day)
|
|
266
|
+
if (includeLocs && dateMatch.indices) {
|
|
267
|
+
tripDateLoc = makeLineLoc(
|
|
268
|
+
lineNumber,
|
|
269
|
+
lineStartIndex,
|
|
270
|
+
...dateMatch.indices[1]
|
|
271
|
+
)
|
|
272
|
+
}
|
|
207
273
|
} else {
|
|
208
274
|
addIssue(
|
|
209
275
|
'warning',
|
|
@@ -225,7 +291,24 @@ export default async function parseFrcsSurveyFile(
|
|
|
225
291
|
if (/^\*\s*%NC(\b|$)/.test(line)) {
|
|
226
292
|
unitsChanged = true
|
|
227
293
|
}
|
|
294
|
+
let match: RegExpMatchArray | null
|
|
295
|
+
if ((match = /^\*\s*%T([ITM])(\b|$)/.exec(line))) {
|
|
296
|
+
const currentUnits = alternateUnits || unwrapInvalid(trip)?.units
|
|
297
|
+
if (currentUnits && !('INVALID' in currentUnits)) {
|
|
298
|
+
alternateUnits = {
|
|
299
|
+
...currentUnits,
|
|
300
|
+
distanceUnit:
|
|
301
|
+
match[1] === 'I'
|
|
302
|
+
? Length.inches
|
|
303
|
+
: match[1] === 'M'
|
|
304
|
+
? Length.meters
|
|
305
|
+
: Length.feet,
|
|
306
|
+
}
|
|
307
|
+
nextShotUnits = alternateUnits
|
|
308
|
+
}
|
|
309
|
+
}
|
|
228
310
|
if (/^\*\s*%/.test(line)) {
|
|
311
|
+
inBlockComment = false
|
|
229
312
|
continue
|
|
230
313
|
}
|
|
231
314
|
if (/[^\s*]/.test(line)) {
|
|
@@ -239,12 +322,23 @@ export default async function parseFrcsSurveyFile(
|
|
|
239
322
|
addCommentLine(line)
|
|
240
323
|
} else if (lineNumber === tripCommentEndLine + 1) {
|
|
241
324
|
if (trip) trips.push(trip)
|
|
325
|
+
const comment = tripComment.join('\n') || undefined
|
|
326
|
+
const headerLocs: FrcsTripHeader['locs'] =
|
|
327
|
+
includeLocs && tripNameLoc
|
|
328
|
+
? {
|
|
329
|
+
name: tripNameLoc,
|
|
330
|
+
date: tripDateLoc,
|
|
331
|
+
section: sectionLoc,
|
|
332
|
+
team: tripTeamLoc,
|
|
333
|
+
}
|
|
334
|
+
: undefined
|
|
242
335
|
const header = {
|
|
243
336
|
name: tripName || '',
|
|
244
|
-
comment
|
|
337
|
+
comment,
|
|
245
338
|
section,
|
|
246
339
|
date: tripDate,
|
|
247
340
|
team: tripTeam,
|
|
341
|
+
...(headerLocs && { locs: headerLocs }),
|
|
248
342
|
}
|
|
249
343
|
const units = parseUnits()
|
|
250
344
|
if (
|
|
@@ -326,7 +420,6 @@ export default async function parseFrcsSurveyFile(
|
|
|
326
420
|
up,
|
|
327
421
|
down,
|
|
328
422
|
},
|
|
329
|
-
excludeDistance: true,
|
|
330
423
|
comment: getComment(),
|
|
331
424
|
}
|
|
332
425
|
addShot(
|
|
@@ -504,11 +597,23 @@ export default async function parseFrcsSurveyFile(
|
|
|
504
597
|
validate(...ranges.backsightInclination, 'inclination', isValidOptFloat)
|
|
505
598
|
frontsightInclination = parseNumber(incFsStr, inclinationUnit)
|
|
506
599
|
backsightInclination = parseNumber(incBsStr, inclinationUnit)
|
|
600
|
+
|
|
601
|
+
validateInclinationRange(
|
|
602
|
+
frontsightInclination,
|
|
603
|
+
...ranges.frontsightInclination
|
|
604
|
+
)
|
|
605
|
+
validateInclinationRange(
|
|
606
|
+
backsightInclination,
|
|
607
|
+
...ranges.backsightInclination
|
|
608
|
+
)
|
|
507
609
|
}
|
|
508
610
|
|
|
509
611
|
const frontsightAzimuth = parseAzimuth(azmFsStr, azimuthUnit)
|
|
510
612
|
const backsightAzimuth = parseAzimuth(azmBsStr, azimuthUnit)
|
|
511
613
|
|
|
614
|
+
validateAzimuthRange(frontsightAzimuth, ...ranges.frontsightAzimuth)
|
|
615
|
+
validateAzimuthRange(backsightAzimuth, ...ranges.backsightAzimuth)
|
|
616
|
+
|
|
512
617
|
if (!/\S/.test(incFsStr) && !/\S/.test(incBsStr)) {
|
|
513
618
|
frontsightInclination = Unitize.degrees(0)
|
|
514
619
|
}
|
|
@@ -531,6 +636,9 @@ export default async function parseFrcsSurveyFile(
|
|
|
531
636
|
},
|
|
532
637
|
excludeDistance,
|
|
533
638
|
comment,
|
|
639
|
+
...(includeLocs && {
|
|
640
|
+
loc: makeLineLoc(lineNumber, lineStartIndex, 0, line.length),
|
|
641
|
+
}),
|
|
534
642
|
}
|
|
535
643
|
if (isSplay) shot.isSplay = true
|
|
536
644
|
if (fromLruds) shot.fromLruds = fromLruds
|
|
@@ -555,6 +663,9 @@ export default async function parseFrcsSurveyFile(
|
|
|
555
663
|
},
|
|
556
664
|
excludeDistance,
|
|
557
665
|
comment,
|
|
666
|
+
...(includeLocs && {
|
|
667
|
+
loc: makeLineLoc(lineNumber, lineStartIndex, 0, line.length),
|
|
668
|
+
}),
|
|
558
669
|
}
|
|
559
670
|
if (isSplay) shot.isSplay = true
|
|
560
671
|
if (fromLruds) shot.fromLruds = fromLruds
|
|
@@ -579,6 +690,7 @@ export default async function parseFrcsSurveyFile(
|
|
|
579
690
|
location,
|
|
580
691
|
trips,
|
|
581
692
|
...(issues.length ? { issues } : undefined),
|
|
693
|
+
...(includeLocs && { locs: rootLocs }),
|
|
582
694
|
}
|
|
583
695
|
}
|
|
584
696
|
|
|
@@ -588,6 +700,7 @@ export default async function parseFrcsSurveyFile(
|
|
|
588
700
|
columns: outputColumns ? columns : undefined,
|
|
589
701
|
location,
|
|
590
702
|
trips,
|
|
703
|
+
...(includeLocs && { locs: rootLocs }),
|
|
591
704
|
},
|
|
592
705
|
issues,
|
|
593
706
|
}
|
|
@@ -756,6 +869,74 @@ export default async function parseFrcsSurveyFile(
|
|
|
756
869
|
return field
|
|
757
870
|
}
|
|
758
871
|
|
|
872
|
+
function validateAzimuthRange(
|
|
873
|
+
azimuth: UnitizedNumber<Angle> | undefined,
|
|
874
|
+
startColumn: number,
|
|
875
|
+
endColumn: number
|
|
876
|
+
) {
|
|
877
|
+
if (!azimuth) return
|
|
878
|
+
const rawValue = azimuth.get(azimuth.unit)
|
|
879
|
+
let max = Infinity
|
|
880
|
+
switch (azimuth.unit) {
|
|
881
|
+
case Angle.degrees:
|
|
882
|
+
max = 360
|
|
883
|
+
break
|
|
884
|
+
case Angle.gradians:
|
|
885
|
+
max = 400
|
|
886
|
+
break
|
|
887
|
+
case Angle.radians:
|
|
888
|
+
max = Math.PI * 2
|
|
889
|
+
break
|
|
890
|
+
case Angle.milsNATO:
|
|
891
|
+
max = 6400
|
|
892
|
+
break
|
|
893
|
+
}
|
|
894
|
+
if (rawValue < 0 || rawValue >= max) {
|
|
895
|
+
addIssue(
|
|
896
|
+
'error',
|
|
897
|
+
'azimuthOutOfRange',
|
|
898
|
+
'Azimuth out of range',
|
|
899
|
+
startColumn,
|
|
900
|
+
endColumn,
|
|
901
|
+
lineIssues
|
|
902
|
+
)
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function validateInclinationRange(
|
|
907
|
+
inclination: UnitizedNumber<Angle> | undefined,
|
|
908
|
+
startColumn: number,
|
|
909
|
+
endColumn: number
|
|
910
|
+
) {
|
|
911
|
+
if (!inclination) return
|
|
912
|
+
const rawValue = inclination.get(inclination.unit)
|
|
913
|
+
let max = Infinity
|
|
914
|
+
switch (inclination.unit) {
|
|
915
|
+
case Angle.degrees:
|
|
916
|
+
max = 90
|
|
917
|
+
break
|
|
918
|
+
case Angle.gradians:
|
|
919
|
+
max = 100
|
|
920
|
+
break
|
|
921
|
+
case Angle.radians:
|
|
922
|
+
max = Math.PI / 2
|
|
923
|
+
break
|
|
924
|
+
case Angle.milsNATO:
|
|
925
|
+
max = 1600
|
|
926
|
+
break
|
|
927
|
+
}
|
|
928
|
+
if (rawValue < -max || rawValue > max) {
|
|
929
|
+
addIssue(
|
|
930
|
+
'error',
|
|
931
|
+
'inclinationOutOfRange',
|
|
932
|
+
'Inclination out of range',
|
|
933
|
+
startColumn,
|
|
934
|
+
endColumn,
|
|
935
|
+
lineIssues
|
|
936
|
+
)
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
759
940
|
function addShot(shot: FrcsShot | InvalidFrcsShot) {
|
|
760
941
|
if (!trip) return
|
|
761
942
|
if (alternateUnits) {
|
|
@@ -844,3 +1025,23 @@ export default async function parseFrcsSurveyFile(
|
|
|
844
1025
|
}
|
|
845
1026
|
}
|
|
846
1027
|
}
|
|
1028
|
+
|
|
1029
|
+
function makeLineLoc(
|
|
1030
|
+
line: number,
|
|
1031
|
+
lineStartIndex: number,
|
|
1032
|
+
startColumn: number,
|
|
1033
|
+
endColumn: number
|
|
1034
|
+
): SourceLoc {
|
|
1035
|
+
return {
|
|
1036
|
+
start: {
|
|
1037
|
+
index: lineStartIndex + startColumn,
|
|
1038
|
+
line,
|
|
1039
|
+
column: startColumn,
|
|
1040
|
+
},
|
|
1041
|
+
end: {
|
|
1042
|
+
index: lineStartIndex + endColumn,
|
|
1043
|
+
line,
|
|
1044
|
+
column: endColumn,
|
|
1045
|
+
},
|
|
1046
|
+
}
|
|
1047
|
+
}
|
package/string/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const parseFrcsSurveyFile: (file: string, str: string, rest_0?: import("../survey/FrcsSurveyFile").ParseFrcsSurveyFileOptions | undefined) => Promise<import("..").FrcsSurveyFile | import("
|
|
1
|
+
export declare const parseFrcsSurveyFile: (file: string, str: string, rest_0?: import("../survey/FrcsSurveyFile").ParseFrcsSurveyFileOptions | undefined) => Promise<import("..").FrcsSurveyFile | import("..").InvalidFrcsSurveyFile>;
|
|
2
2
|
export declare const parseFrcsPlotFile: (file: string, str: string) => Promise<import("..").FrcsPlotFile>;
|
|
3
3
|
export declare const parseFrcsTripSummaryFile: (file: string, str: string, rest_0?: {
|
|
4
4
|
indexBy?: "tripNumber" | "occurrence";
|
package/string/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB,SAHvB,MAAM,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB,SAHvB,MAAM,OAAO,MAAM,kKAG8C,CAAA;AAC1E,eAAO,MAAM,iBAAiB,SAfrB,MAAM,OAAO,MAAM,uCAeyC,CAAA;AACrE,eAAO,MAAM,wBAAwB,SAhB5B,MAAM,OAAO,MAAM;;2DAkB3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrcsSurveyFile.d.ts","sourceRoot":"","sources":["../../src/survey/FrcsSurveyFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1E,KAAK,OAAO,CAAC,CAAC,IAAI;IAChB,OAAO,EAAE,CAAC,CAAA;IACV;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAGD,KAAK,QAAQ,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,EAAE,CAAA;AAEhD,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,QAAQ,CAA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,EAAE,SAAS,CAAA;KACpB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,YAAY,GAAG;QAAE,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,OAAO,CACL,OAAO,CACL,QAAQ,EACR;IACE,QAAQ,CAAC,EACL,QAAQ,CAAC,UAAU,CAAC,GACpB,OAAO,CACL,OAAO,CAAC,YAAY,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,SAAS,GAAG,gBAAgB,CAAA;KAAE,CACjE,CAAA;CACN,CACF,CACF,CACF,CAAA;AAED,eAAO,MAAM,2BAA2B,EAAE,oBAgBzC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,CAAC,EAAE,oBAAoB,CAAA;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gBAAgB,CAAC,EACb,OAAO,GACP;QACE,eAAe,CAAC,EAAE,OAAO,CAAA;QACzB,eAAe,CAAC,EAAE,OAAO,CAAA;KAC1B,CAAA;IACL,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrcsSurveyFile.js","names":["defaultFrcsShotColumnConfig","exports","toStation","fromStation","distance","distanceFeet","distanceInches","kind","exclude","frontsightAzimuth","backsightAzimuth","frontsightInclination","backsightInclination","left","right","up","down"],"sources":["../../src/survey/FrcsSurveyFile.ts"],"sourcesContent":["import { ParseIssue } from '../ParseIssue'\nimport { SourceLoc } from '../SourceLoc'\nimport { Unit, Length, Angle, UnitizedNumber } from '@speleotica/unitized'\n\ntype Invalid<T> = {\n INVALID: T\n /**\n * An array of indexes of issues in {@link InvalidFrcsSurveyFile['issues']} within the\n * `INVALID` node\n */\n issues?: number[]\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype Prettify<T> = { [K in keyof T]: T[K] } & {}\n\ntype Replace<T, U> = Prettify<Omit<T, keyof U> & U>\n\nexport type FrcsSurveyFile = {\n cave?: string\n columns?: FrcsShotColumnConfig\n location?: string\n comment?: string\n trips: FrcsTrip[]\n locs?: {\n cave?: SourceLoc\n location?: SourceLoc\n comment?: SourceLoc\n }\n issues?: ParseIssue[]\n}\n\nexport type FrcsShotColumnConfig = {\n toStation: number\n fromStation: number\n distance: number\n distanceFeet: number\n distanceInches: number\n kind: number\n exclude: number\n frontsightAzimuth: number\n backsightAzimuth: number\n frontsightInclination: number\n backsightInclination: number\n left: number\n right: number\n up: number\n down: number\n}\n\nexport type InvalidFrcsSurveyFile = {\n INVALID: Replace<\n FrcsSurveyFile,\n {\n trips: (FrcsTrip | InvalidFrcsTrip)[]\n }\n >\n issues: ParseIssue[]\n}\n\nexport type FrcsUnits = {\n distanceUnit: Unit<Length>\n azimuthUnit: Unit<Angle>\n inclinationUnit: Unit<Angle>\n backsightAzimuthCorrected?: boolean\n backsightInclinationCorrected?: boolean\n hasBacksightAzimuth?: boolean\n hasBacksightInclination?: boolean\n loc?: SourceLoc\n locs?: {\n distanceUnit?: SourceLoc\n azimuthUnit?: SourceLoc\n inclinationUnit?: SourceLoc\n backsightAzimuthCorrected?: SourceLoc\n backsightInclinationCorrected?: SourceLoc\n hasBacksightAzimuth?: SourceLoc\n hasBacksightInclination?: SourceLoc\n }\n}\n\nexport type InvalidFrcsUnits = Invalid<Partial<FrcsUnits>>\n\nexport type FrcsTripHeader = {\n name: string\n comment?: string\n section?: string\n date?: Date\n team?: string[]\n loc?: SourceLoc\n locs?: {\n name: SourceLoc\n comment?: SourceLoc\n section?: SourceLoc\n date?: SourceLoc\n team?: SourceLoc[]\n }\n}\n\nexport type InvalidFrcsTripHeader = Invalid<Partial<FrcsTripHeader>>\n\nexport type FrcsTrip = {\n tripNumber: number\n header: FrcsTripHeader\n units: FrcsUnits\n shots: FrcsShot[]\n loc?: SourceLoc\n}\n\nexport type InvalidFrcsTrip = Invalid<\n Replace<\n FrcsTrip,\n {\n tripNumber?: number\n header: FrcsTripHeader | InvalidFrcsTripHeader\n units: FrcsUnits | InvalidFrcsUnits\n shots: (FrcsShot | InvalidFrcsShot)[]\n }\n >\n>\n\nexport type FrcsShotBase = {\n /**\n * Name of from station\n */\n from: string\n /**\n * Name of to station\n */\n to?: string\n specialKind?: 'horizontal' | 'diagonal'\n distance: UnitizedNumber<Length>\n horizontalDistance?: UnitizedNumber<Length>\n verticalDistance?: UnitizedNumber<Length>\n frontsightAzimuth?: UnitizedNumber<Angle>\n frontsightInclination?: UnitizedNumber<Angle>\n backsightAzimuth?: UnitizedNumber<Angle>\n backsightInclination?: UnitizedNumber<Angle>\n /**\n * LRUDs at from station\n */\n fromLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n /**\n * LRUDs at to station\n */\n toLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n excludeDistance?: boolean\n isSplay?: boolean\n comment?: string\n loc?: SourceLoc\n locs?: {\n comment?: SourceLoc\n }\n}\n\nexport type FrcsShot = FrcsShotBase & {\n /**\n * In the edge case that the surveyors changed measurement units or\n * corrected/uncorrected backsights in the middle of a trip, the measurements\n * will be normalized to the initial trip settings, and this field will contain\n * the actual values recorded, verbatim. The first shot of the group with\n * changed units will include the changed units.\n */\n recorded?: FrcsShotBase & { units?: FrcsUnits }\n}\n\nexport type InvalidFrcsShot = Invalid<\n Partial<\n Replace<\n FrcsShot,\n {\n recorded?:\n | FrcsShot['recorded']\n | Invalid<\n Partial<FrcsShotBase> & { units?: FrcsUnits | InvalidFrcsUnits }\n >\n }\n >\n >\n>\n\nexport const defaultFrcsShotColumnConfig: FrcsShotColumnConfig = {\n toStation: 5,\n fromStation: 5,\n distance: 6,\n distanceFeet: 4,\n distanceInches: 3,\n kind: 1,\n exclude: 1,\n frontsightAzimuth: 6,\n backsightAzimuth: 6,\n frontsightInclination: 5,\n backsightInclination: 5,\n left: 3,\n right: 3,\n up: 3,\n down: 3,\n}\n\nexport type ParseFrcsSurveyFileOptions = {\n columns?: FrcsShotColumnConfig\n outputColumns?: boolean\n normalizeNames?: boolean\n suppressWarnings?:\n | boolean\n | {\n missingTripTeam?: boolean\n missingTripDate?: boolean\n }\n}\n"],"mappings":";;;;;;AAaA;;AAiLO,MAAMA,2BAAiD,GAAAC,OAAA,CAAAD,2BAAA,GAAG;EAC/DE,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,cAAc,EAAE,CAAC;EACjBC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAE,CAAC;EACpBC,gBAAgB,EAAE,CAAC;EACnBC,qBAAqB,EAAE,CAAC;EACxBC,oBAAoB,EAAE,CAAC;EACvBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,EAAE,EAAE,CAAC;EACLC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FrcsSurveyFile.js","names":["defaultFrcsShotColumnConfig","exports","toStation","fromStation","distance","distanceFeet","distanceInches","kind","exclude","frontsightAzimuth","backsightAzimuth","frontsightInclination","backsightInclination","left","right","up","down"],"sources":["../../src/survey/FrcsSurveyFile.ts"],"sourcesContent":["import { ParseIssue } from '../ParseIssue'\nimport { SourceLoc } from '../SourceLoc'\nimport { Unit, Length, Angle, UnitizedNumber } from '@speleotica/unitized'\n\ntype Invalid<T> = {\n INVALID: T\n /**\n * An array of indexes of issues in {@link InvalidFrcsSurveyFile['issues']} within the\n * `INVALID` node\n */\n issues?: number[]\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype Prettify<T> = { [K in keyof T]: T[K] } & {}\n\ntype Replace<T, U> = Prettify<Omit<T, keyof U> & U>\n\nexport type FrcsSurveyFile = {\n cave?: string\n columns?: FrcsShotColumnConfig\n location?: string\n comment?: string\n trips: FrcsTrip[]\n locs?: {\n cave?: SourceLoc\n location?: SourceLoc\n comment?: SourceLoc\n }\n issues?: ParseIssue[]\n}\n\nexport type FrcsShotColumnConfig = {\n toStation: number\n fromStation: number\n distance: number\n distanceFeet: number\n distanceInches: number\n kind: number\n exclude: number\n frontsightAzimuth: number\n backsightAzimuth: number\n frontsightInclination: number\n backsightInclination: number\n left: number\n right: number\n up: number\n down: number\n}\n\nexport type InvalidFrcsSurveyFile = {\n INVALID: Replace<\n FrcsSurveyFile,\n {\n trips: (FrcsTrip | InvalidFrcsTrip)[]\n }\n >\n issues: ParseIssue[]\n}\n\nexport type FrcsUnits = {\n distanceUnit: Unit<Length>\n azimuthUnit: Unit<Angle>\n inclinationUnit: Unit<Angle>\n backsightAzimuthCorrected?: boolean\n backsightInclinationCorrected?: boolean\n hasBacksightAzimuth?: boolean\n hasBacksightInclination?: boolean\n loc?: SourceLoc\n locs?: {\n distanceUnit?: SourceLoc\n azimuthUnit?: SourceLoc\n inclinationUnit?: SourceLoc\n backsightAzimuthCorrected?: SourceLoc\n backsightInclinationCorrected?: SourceLoc\n hasBacksightAzimuth?: SourceLoc\n hasBacksightInclination?: SourceLoc\n }\n}\n\nexport type InvalidFrcsUnits = Invalid<Partial<FrcsUnits>>\n\nexport type FrcsTripHeader = {\n name: string\n comment?: string\n section?: string\n date?: Date\n team?: string[]\n loc?: SourceLoc\n locs?: {\n name: SourceLoc\n comment?: SourceLoc\n section?: SourceLoc\n date?: SourceLoc\n team?: SourceLoc[]\n }\n}\n\nexport type InvalidFrcsTripHeader = Invalid<Partial<FrcsTripHeader>>\n\nexport type FrcsTrip = {\n tripNumber: number\n header: FrcsTripHeader\n units: FrcsUnits\n shots: FrcsShot[]\n loc?: SourceLoc\n}\n\nexport type InvalidFrcsTrip = Invalid<\n Replace<\n FrcsTrip,\n {\n tripNumber?: number\n header: FrcsTripHeader | InvalidFrcsTripHeader\n units: FrcsUnits | InvalidFrcsUnits\n shots: (FrcsShot | InvalidFrcsShot)[]\n }\n >\n>\n\nexport type FrcsShotBase = {\n /**\n * Name of from station\n */\n from: string\n /**\n * Name of to station\n */\n to?: string\n specialKind?: 'horizontal' | 'diagonal'\n distance: UnitizedNumber<Length>\n horizontalDistance?: UnitizedNumber<Length>\n verticalDistance?: UnitizedNumber<Length>\n frontsightAzimuth?: UnitizedNumber<Angle>\n frontsightInclination?: UnitizedNumber<Angle>\n backsightAzimuth?: UnitizedNumber<Angle>\n backsightInclination?: UnitizedNumber<Angle>\n /**\n * LRUDs at from station\n */\n fromLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n /**\n * LRUDs at to station\n */\n toLruds?: {\n left?: UnitizedNumber<Length>\n right?: UnitizedNumber<Length>\n up?: UnitizedNumber<Length>\n down?: UnitizedNumber<Length>\n }\n excludeDistance?: boolean\n isSplay?: boolean\n comment?: string\n loc?: SourceLoc\n locs?: {\n comment?: SourceLoc\n }\n}\n\nexport type FrcsShot = FrcsShotBase & {\n /**\n * In the edge case that the surveyors changed measurement units or\n * corrected/uncorrected backsights in the middle of a trip, the measurements\n * will be normalized to the initial trip settings, and this field will contain\n * the actual values recorded, verbatim. The first shot of the group with\n * changed units will include the changed units.\n */\n recorded?: FrcsShotBase & { units?: FrcsUnits }\n}\n\nexport type InvalidFrcsShot = Invalid<\n Partial<\n Replace<\n FrcsShot,\n {\n recorded?:\n | FrcsShot['recorded']\n | Invalid<\n Partial<FrcsShotBase> & { units?: FrcsUnits | InvalidFrcsUnits }\n >\n }\n >\n >\n>\n\nexport const defaultFrcsShotColumnConfig: FrcsShotColumnConfig = {\n toStation: 5,\n fromStation: 5,\n distance: 6,\n distanceFeet: 4,\n distanceInches: 3,\n kind: 1,\n exclude: 1,\n frontsightAzimuth: 6,\n backsightAzimuth: 6,\n frontsightInclination: 5,\n backsightInclination: 5,\n left: 3,\n right: 3,\n up: 3,\n down: 3,\n}\n\nexport type ParseFrcsSurveyFileOptions = {\n columns?: FrcsShotColumnConfig\n outputColumns?: boolean\n normalizeNames?: boolean\n suppressWarnings?:\n | boolean\n | {\n missingTripTeam?: boolean\n missingTripDate?: boolean\n }\n includeLocs?: boolean\n}\n"],"mappings":";;;;;;AAaA;;AAiLO,MAAMA,2BAAiD,GAAAC,OAAA,CAAAD,2BAAA,GAAG;EAC/DE,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,cAAc,EAAE,CAAC;EACjBC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAE,CAAC;EACpBC,gBAAgB,EAAE,CAAC;EACnBC,qBAAqB,EAAE,CAAC;EACxBC,oBAAoB,EAAE,CAAC;EACvBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,EAAE,EAAE,CAAC;EACLC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
|