mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 15:43:25 +00:00
functional with immer
This commit is contained in:
10
gpx/package-lock.json
generated
10
gpx/package-lock.json
generated
@@ -9,6 +9,7 @@
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"fast-xml-parser": "^4.3.6",
|
||||
"immer": "^10.1.1",
|
||||
"ts-node": "^10.9.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -1958,6 +1959,15 @@
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/immer": {
|
||||
"version": "10.1.1",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz",
|
||||
"integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/immer"
|
||||
}
|
||||
},
|
||||
"node_modules/import-local": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz",
|
||||
|
@@ -12,6 +12,7 @@
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"fast-xml-parser": "^4.3.6",
|
||||
"immer": "^10.1.1",
|
||||
"ts-node": "^10.9.2"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -26,4 +27,4 @@
|
||||
"ts-jest": "^29.1.2",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Coordinates, GPXFileAttributes, GPXFileType, Link, Metadata, TrackExtensions, TrackPointExtensions, TrackPointType, TrackSegmentType, TrackType, WaypointType } from "./types";
|
||||
import { immerable } from "immer";
|
||||
|
||||
function cloneJSON<T>(obj: T): T {
|
||||
if (obj === null || typeof obj !== 'object') {
|
||||
@@ -120,6 +121,8 @@ export class GPXFiles extends GPXTreeNode<GPXFile> {
|
||||
|
||||
// A class that represents a GPX file
|
||||
export class GPXFile extends GPXTreeNode<Track>{
|
||||
[immerable] = true;
|
||||
|
||||
attributes: GPXFileAttributes;
|
||||
metadata: Metadata;
|
||||
wpt: Waypoint[];
|
||||
@@ -176,6 +179,8 @@ export class GPXFile extends GPXTreeNode<Track>{
|
||||
|
||||
// A class that represents a Track in a GPX file
|
||||
export class Track extends GPXTreeNode<TrackSegment> {
|
||||
[immerable] = true;
|
||||
|
||||
name?: string;
|
||||
cmt?: string;
|
||||
desc?: string;
|
||||
@@ -256,6 +261,8 @@ export class Track extends GPXTreeNode<TrackSegment> {
|
||||
|
||||
// A class that represents a TrackSegment in a GPX file
|
||||
export class TrackSegment extends GPXTreeLeaf {
|
||||
[immerable] = true;
|
||||
|
||||
trkpt: TrackPoint[];
|
||||
|
||||
constructor(segment?: TrackSegmentType | TrackSegment) {
|
||||
@@ -432,6 +439,8 @@ export class TrackSegment extends GPXTreeLeaf {
|
||||
};
|
||||
|
||||
export class TrackPoint {
|
||||
[immerable] = true;
|
||||
|
||||
attributes: Coordinates;
|
||||
ele?: number;
|
||||
time?: Date;
|
||||
|
Reference in New Issue
Block a user