Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(function (resolve, reject) {
var fitFileParser = new FitFileParser({
force: true,
speedUnit: 'm/s',
lengthUnit: 'm',
temperatureUnit: 'celsius',
elapsedRecordField: false,
mode: 'both',
});
fitFileParser.parse(arrayBuffer, function (error, fitDataObject) {
// debugger;
// Iterate over the sessions and create their activities
var activities = fitDataObject.sessions.map(function (sessionObject) {
// Get the activity from the sessionObject
var activity = _this.getActivityFromSessionObject(sessionObject, fitDataObject);
// Go over the laps
sessionObject.laps.forEach(function (sessionLapObject) {
activity.addLap(_this.getLapFromSessionLapObject(sessionLapObject));