@sports-alliance/sports-lib
Version:
A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc
33 lines (32 loc) • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Creator = void 0;
var Creator = /** @class */ (function () {
function Creator(name, swInfo, hwInfo, serialNumber) {
this.devices = [];
this.name = name;
if (swInfo) {
this.swInfo = swInfo;
}
if (hwInfo) {
this.hwInfo = hwInfo;
}
if (serialNumber) {
this.serialNumber = serialNumber;
}
}
Creator.prototype.toJSON = function () {
return {
name: this.name,
serialNumber: this.serialNumber ? this.serialNumber : null,
swInfo: this.swInfo ? this.swInfo : null,
hwInfo: this.hwInfo ? this.hwInfo : null,
devices: this.devices.reduce(function (devicesArray, device) {
devicesArray.push(device.toJSON());
return devicesArray;
}, [])
};
};
return Creator;
}());
exports.Creator = Creator;