quantified-self-lib
Advanced tools
Comparing version 1.0.0-pre-10 to 1.0.0-pre-11
@@ -28,3 +28,2 @@ "use strict"; | ||
var data_speed_avg_1 = require("../../../../data/data.speed-avg"); | ||
var data_cadence_max_1 = require("../../../../data/data.cadence-max"); | ||
var data_power_max_1 = require("../../../../data/data.power-max"); | ||
@@ -38,2 +37,9 @@ var data_ascent_1 = require("../../../../data/data.ascent"); | ||
var lap_types_1 = require("../../../../laps/lap.types"); | ||
var data_pace_1 = require("../../../../data/data.pace"); | ||
var data_pace_avg_1 = require("../../../../data/data.pace-avg"); | ||
var data_pace_max_1 = require("../../../../data/data.pace-max"); | ||
var data_heart_rate_min_1 = require("../../../../data/data.heart-rate-min"); | ||
var data_cadence_min_1 = require("../../../../data/data.cadence-min"); | ||
var data_power_min_1 = require("../../../../data/data.power-min"); | ||
var data_pace_min_1 = require("../../../../data/data.pace-min"); | ||
var EasyFit = require('easy-fit').default; | ||
@@ -56,2 +62,3 @@ var EventImporterFIT = /** @class */ (function () { | ||
easyFitParser.parse(arrayBuffer, function (error, fitDataObject) { | ||
debugger; | ||
// Create an event | ||
@@ -117,3 +124,3 @@ var event = new event_1.Event(name); | ||
point.addData(new data_speed_1.DataSpeed(sessionLapObjectRecord.speed)); | ||
point.addData(new data_speed_1.DataSpeed(1000 / sessionLapObjectRecord.speed)); | ||
point.addData(new data_pace_1.DataPace(event_utilities_1.convertSpeedToPace(sessionLapObjectRecord.speed))); | ||
} | ||
@@ -178,2 +185,5 @@ // Add Vertical Speed | ||
} | ||
if (event_utilities_1.isNumberOrString(object.min_heart_rate)) { | ||
stats.push(new data_heart_rate_min_1.DataHeartRateMin(object.min_heart_rate)); | ||
} | ||
if (event_utilities_1.isNumberOrString(object.max_heart_rate)) { | ||
@@ -185,4 +195,7 @@ stats.push(new data_heart_rate_max_1.DataHeartRateMax(object.max_heart_rate)); | ||
} | ||
if (event_utilities_1.isNumberOrString(object.min_cadence)) { | ||
stats.push(new data_cadence_avg_1.DataCadenceAvg(object.avg_cadence)); | ||
} | ||
if (event_utilities_1.isNumberOrString(object.max_cadence)) { | ||
stats.push(new data_cadence_max_1.DataCadenceMax(object.max_cadence)); | ||
stats.push(new data_cadence_min_1.DataCadenceMin(object.min_cadence)); | ||
} | ||
@@ -192,2 +205,5 @@ if (event_utilities_1.isNumberOrString(object.avg_power)) { | ||
} | ||
if (event_utilities_1.isNumberOrString(object.min_power)) { | ||
stats.push(new data_power_min_1.DataPowerMin(object.min_power)); | ||
} | ||
if (event_utilities_1.isNumberOrString(object.max_power)) { | ||
@@ -198,5 +214,11 @@ stats.push(new data_power_max_1.DataPowerMax(object.max_power)); | ||
stats.push(new data_speed_avg_1.DataSpeedAvg(object.avg_speed)); | ||
stats.push(new data_pace_avg_1.DataPaceAvg(event_utilities_1.convertSpeedToPace(object.avg_speed))); | ||
} | ||
if (event_utilities_1.isNumberOrString(object.min_speed)) { | ||
stats.push(new data_speed_avg_1.DataSpeedAvg(object.min_speed)); | ||
stats.push(new data_pace_min_1.DataPaceMin(event_utilities_1.convertSpeedToPace(object.min_speed))); | ||
} | ||
if (event_utilities_1.isNumberOrString(object.max_speed)) { | ||
stats.push(new data_speed_max_1.DataSpeedMax(object.max_speed)); | ||
stats.push(new data_pace_max_1.DataPaceMax(event_utilities_1.convertSpeedToPace(object.max_speed))); | ||
} | ||
@@ -203,0 +225,0 @@ if (event_utilities_1.isNumberOrString(object.total_ascent)) { |
@@ -112,3 +112,3 @@ "use strict"; | ||
point.addData(new data_speed_1.DataSpeed(Number(extensionData[key][0]))); | ||
point.addData(new data_pace_1.DataPace(1000 / Number(extensionData[key][0]))); | ||
point.addData(new data_pace_1.DataPace(event_utilities_1.convertSpeedToPace(Number(extensionData[key][0])))); | ||
} | ||
@@ -115,0 +115,0 @@ if (key === 'verticalSpeed') { |
@@ -274,3 +274,3 @@ "use strict"; | ||
point.addData(new data_speed_1.DataSpeed(sample.Speed)); | ||
point.addData(new data_pace_1.DataPace(1000 / sample.Speed)); | ||
point.addData(new data_pace_1.DataPace(event_utilities_1.convertSpeedToPace(sample.Speed))); | ||
} | ||
@@ -408,11 +408,11 @@ if (event_utilities_1.isNumberOrString(sample.Temperature)) { | ||
stats.push(new data_speed_avg_1.DataSpeedAvg(object.Speed[0].Avg)); | ||
stats.push(new data_pace_avg_1.DataPaceAvg(1000 / object.Speed[0].Avg)); | ||
stats.push(new data_pace_avg_1.DataPaceAvg(event_utilities_1.convertSpeedToPace(object.Speed[0].Avg))); | ||
} | ||
if (object.Speed[0].Max !== null) { | ||
stats.push(new data_speed_max_1.DataSpeedMax(object.Speed[0].Max)); | ||
stats.push(new data_pace_max_1.DataPaceMax(1000 / object.Speed[0].Max)); | ||
stats.push(new data_pace_max_1.DataPaceMax(event_utilities_1.convertSpeedToPace(object.Speed[0].Max))); | ||
} | ||
if (object.Speed[0].Min !== null) { | ||
stats.push(new data_speed_min_1.DataSpeedMin(object.Speed[0].Min)); | ||
stats.push(new data_pace_min_1.DataPaceMin(1000 / object.Speed[0].Min)); | ||
stats.push(new data_pace_min_1.DataPaceMin(event_utilities_1.convertSpeedToPace(object.Speed[0].Min))); | ||
} | ||
@@ -419,0 +419,0 @@ } |
@@ -28,2 +28,4 @@ "use strict"; | ||
var data_pace_1 = require("../../../../data/data.pace"); | ||
var data_pace_avg_1 = require("../../../../data/data.pace-avg"); | ||
var data_pace_max_1 = require("../../../../data/data.pace-max"); | ||
var EventImporterTCX = /** @class */ (function () { | ||
@@ -114,3 +116,3 @@ function EventImporterTCX() { | ||
point.addData(new data_speed_1.DataSpeed(Number(dataExtensionElement.textContent))); | ||
point.addData(new data_pace_1.DataPace(1000 / Number(dataExtensionElement.textContent))); | ||
point.addData(new data_pace_1.DataPace(event_utilities_1.convertSpeedToPace(Number(dataExtensionElement.textContent)))); | ||
break; | ||
@@ -162,2 +164,3 @@ } | ||
lap.addStat(new data_speed_max_1.DataSpeedMax(Number(lapElement.getElementsByTagName('MaximumSpeed')[0].textContent))); | ||
lap.addStat(new data_pace_max_1.DataPaceMax(event_utilities_1.convertSpeedToPace(Number(lapElement.getElementsByTagName('MaximumSpeed')[0].textContent)))); | ||
} | ||
@@ -172,2 +175,3 @@ if (lapElement.getElementsByTagName('AverageHeartRateBpm')[0]) { | ||
lap.addStat(new data_speed_avg_1.DataSpeedAvg(Number(lapElement.getElementsByTagName('Extensions')[0].getElementsByTagName('AvgSpeed')[0].textContent))); | ||
lap.addStat(new data_pace_avg_1.DataPaceAvg(event_utilities_1.convertSpeedToPace(Number(lapElement.getElementsByTagName('Extensions')[0].getElementsByTagName('AvgSpeed')[0].textContent)))); | ||
} | ||
@@ -174,0 +178,0 @@ // Should check the track |
@@ -18,1 +18,7 @@ import { EventInterface } from '../event.interface'; | ||
export declare function isNumberOrString(property: any): boolean; | ||
/** | ||
* Converts speed from m/s to pace as of seconds | ||
* @param {number} number | ||
* @return {number} | ||
*/ | ||
export declare function convertSpeedToPace(number: number): number; |
@@ -316,1 +316,10 @@ "use strict"; | ||
exports.isNumberOrString = isNumberOrString; | ||
/** | ||
* Converts speed from m/s to pace as of seconds | ||
* @param {number} number | ||
* @return {number} | ||
*/ | ||
function convertSpeedToPace(number) { | ||
return number === 0 ? number : (1000 / number); | ||
} | ||
exports.convertSpeedToPace = convertSpeedToPace; |
{ | ||
"name": "quantified-self-lib", | ||
"version": "1.0.0-pre-10", | ||
"version": "1.0.0-pre-11", | ||
"description": "A Library to for processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
264141
5480
0