@speleotica/frcsdata 4.0.4 → 4.1.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/package.json +5 -1
- package/web/index.d.ts +12 -0
- package/web/index.js +71 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speleotica/frcsdata",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "parser for Chip Hopper's survey data format used in Fisher Ridge Cave System",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"types": "./string/index.d.ts",
|
|
41
41
|
"default": "./string/index.js"
|
|
42
42
|
},
|
|
43
|
+
"./web": {
|
|
44
|
+
"types": "./web/index.d.ts",
|
|
45
|
+
"default": "./web/index.js"
|
|
46
|
+
},
|
|
43
47
|
"./*": {
|
|
44
48
|
"types": "./*.d.ts",
|
|
45
49
|
"default": "./*.js"
|
package/web/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const parseFrcsSurveyFile: {
|
|
2
|
+
(file: File): Promise<import("..").FrcsSurveyFile>;
|
|
3
|
+
(file: string, input: Blob | ReadableStream<Uint8Array>): Promise<import("..").FrcsSurveyFile>;
|
|
4
|
+
};
|
|
5
|
+
export declare const parseFrcsPlotFile: {
|
|
6
|
+
(file: File): Promise<import("..").FrcsPlotFile>;
|
|
7
|
+
(file: string, input: Blob | ReadableStream<Uint8Array>): Promise<import("..").FrcsPlotFile>;
|
|
8
|
+
};
|
|
9
|
+
export declare const parseFrcsTripSummaryFile: {
|
|
10
|
+
(file: File): Promise<import("..").FrcsTripSummaryFile>;
|
|
11
|
+
(file: string, input: Blob | ReadableStream<Uint8Array>): Promise<import("..").FrcsTripSummaryFile>;
|
|
12
|
+
};
|
package/web/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.parseFrcsTripSummaryFile = exports.parseFrcsSurveyFile = exports.parseFrcsPlotFile = void 0;
|
|
8
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
var _parseFrcsSurveyFile2 = _interopRequireDefault(require("../parseFrcsSurveyFile.js"));
|
|
15
|
+
var _parseFrcsPlotFile2 = _interopRequireDefault(require("../parseFrcsPlotFile.js"));
|
|
16
|
+
var _parseFrcsTripSummaryFile2 = _interopRequireDefault(require("../parseFrcsTripSummaryFile.js"));
|
|
17
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
18
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
20
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
var LinesTransform = /*#__PURE__*/function (_TransformStream) {
|
|
23
|
+
function LinesTransform() {
|
|
24
|
+
var _this;
|
|
25
|
+
(0, _classCallCheck2["default"])(this, LinesTransform);
|
|
26
|
+
_this = _callSuper(this, LinesTransform, [{
|
|
27
|
+
transform: function transform(chunk, controller) {
|
|
28
|
+
var end = 0;
|
|
29
|
+
var _iterator = _createForOfIteratorHelper(chunk.matchAll(/\r\n?|\n/gm)),
|
|
30
|
+
_step;
|
|
31
|
+
try {
|
|
32
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
33
|
+
var match = _step.value;
|
|
34
|
+
_this.parts.push(chunk.substring(end, match.index));
|
|
35
|
+
controller.enqueue(_this.parts.join(''));
|
|
36
|
+
_this.parts.length = 0;
|
|
37
|
+
end = match.index + match[0].length;
|
|
38
|
+
}
|
|
39
|
+
} catch (err) {
|
|
40
|
+
_iterator.e(err);
|
|
41
|
+
} finally {
|
|
42
|
+
_iterator.f();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
flush: function flush(controller) {
|
|
46
|
+
if (_this.parts.length) {
|
|
47
|
+
controller.enqueue(_this.parts.join(''));
|
|
48
|
+
_this.parts.length = 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}]);
|
|
52
|
+
(0, _defineProperty2["default"])(_this, "parts", []);
|
|
53
|
+
return _this;
|
|
54
|
+
}
|
|
55
|
+
(0, _inherits2["default"])(LinesTransform, _TransformStream);
|
|
56
|
+
return (0, _createClass2["default"])(LinesTransform);
|
|
57
|
+
}(TransformStream);
|
|
58
|
+
function linesOf(input) {
|
|
59
|
+
// @ts-expect-error missing async iterable type defs
|
|
60
|
+
return (input instanceof ReadableStream ? input : input.stream()).pipeThrough(new TextDecoderStream()).pipeThrough(new LinesTransform());
|
|
61
|
+
}
|
|
62
|
+
var convert = function convert(fn) {
|
|
63
|
+
function converted(file, input) {
|
|
64
|
+
if (file instanceof File) return converted(file.name, file);
|
|
65
|
+
return fn(file, linesOf(input));
|
|
66
|
+
}
|
|
67
|
+
return converted;
|
|
68
|
+
};
|
|
69
|
+
var parseFrcsSurveyFile = exports.parseFrcsSurveyFile = convert(_parseFrcsSurveyFile2["default"]);
|
|
70
|
+
var parseFrcsPlotFile = exports.parseFrcsPlotFile = convert(_parseFrcsPlotFile2["default"]);
|
|
71
|
+
var parseFrcsTripSummaryFile = exports.parseFrcsTripSummaryFile = convert(_parseFrcsTripSummaryFile2["default"]);
|