quantified-self-lib
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -19,15 +19,37 @@ import { ActivityInterface } from './activity.interface'; | ||
createStream(type: string): StreamInterface; | ||
addDataToStream(type: string, date: Date, value: number): void; | ||
addStream(stream: StreamInterface): void; | ||
clearStreams(): void; | ||
removeStream(stream: StreamInterface): void; | ||
addStreams(streams: StreamInterface[]): void; | ||
addDataToStream(type: string, date: Date, value: number): this; | ||
addStream(stream: StreamInterface): this; | ||
clearStreams(): this; | ||
removeStream(stream: StreamInterface): this; | ||
addStreams(streams: StreamInterface[]): this; | ||
getAllStreams(): StreamInterface[]; | ||
getAllExportableStreams(): StreamInterface[]; | ||
hasStreamData(streamType: string, startDate?: Date, endDate?: Date): boolean; | ||
hasStreamData(streamType: string | StreamInterface, startDate?: Date, endDate?: Date): boolean; | ||
hasPositionData(startDate?: Date, endDate?: Date): boolean; | ||
getStream(streamType: string): StreamInterface; | ||
getStreamData(streamType: string, startDate?: Date, endDate?: Date): (number | null)[]; | ||
getStreamData(streamType: string | StreamInterface, startDate?: Date, endDate?: Date): (number | null)[]; | ||
/** | ||
* Gets the data array of an activity stream excluding the non numeric ones | ||
* @todo include strings and all data abstract types | ||
* @param streamType | ||
* @param startDate | ||
* @param endDate | ||
*/ | ||
getSquashedStreamData(streamType: string, startDate?: Date, endDate?: Date): number[]; | ||
getPositionData(startDate?: Date, endDate?: Date): (DataPositionInterface | null)[]; | ||
/** | ||
* Combines the lat - long streams to a DataPositionInterface | ||
* @param startDate | ||
* @param endDate | ||
* @param latitudeStream | ||
* @param longitudeStream | ||
*/ | ||
getPositionData(startDate?: Date, endDate?: Date, latitudeStream?: StreamInterface, longitudeStream?: StreamInterface): (DataPositionInterface | null)[]; | ||
/** | ||
* Combines the lat - long streams to a DataPositionInterface and excludes nulls | ||
* @param startDate | ||
* @param endDate | ||
* @param latitudeStream | ||
* @param longitudeStream | ||
*/ | ||
getSquashedPositionData(startDate?: Date, endDate?: Date, latitudeStream?: StreamInterface, longitudeStream?: StreamInterface): DataPositionInterface[]; | ||
getStreamDataTypesBasedOnDataType(streamTypeToBaseOn: string, streamTypes: string[]): { | ||
@@ -44,5 +66,5 @@ [type: string]: { | ||
getStreamDataByTime(streamType: string): StreamDataItem[]; | ||
addLap(lap: LapInterface): void; | ||
addLap(lap: LapInterface): this; | ||
getLaps(activity?: ActivityInterface): LapInterface[]; | ||
toJSON(): ActivityJSONInterface; | ||
} |
@@ -16,5 +16,5 @@ import { CreatorInterface } from '../creators/creator.interface'; | ||
intensityZones: IntensityZonesInterface[]; | ||
hasStreamData(streamType: string, startDate?: Date, endDate?: Date): boolean; | ||
hasStreamData(streamType: string | StreamInterface, startDate?: Date, endDate?: Date): boolean; | ||
hasPositionData(startDate?: Date, endDate?: Date): boolean; | ||
getStreamData(streamType: string, startDate?: Date, endDate?: Date): (number | null)[]; | ||
getStreamData(streamType: string | StreamInterface, startDate?: Date, endDate?: Date): (number | null)[]; | ||
getSquashedStreamData(streamType: string, startDate?: Date, endDate?: Date): number[]; | ||
@@ -34,13 +34,14 @@ getStreamDataByTime(streamType: string): StreamDataItem[]; | ||
getStream(type: string): StreamInterface; | ||
addStream(stream: StreamInterface): void; | ||
addStreams(streams: StreamInterface[]): void; | ||
removeStream(stream: StreamInterface): void; | ||
addStream(stream: StreamInterface): this; | ||
addStreams(streams: StreamInterface[]): this; | ||
removeStream(stream: StreamInterface): this; | ||
getAllStreams(): StreamInterface[]; | ||
getAllExportableStreams(): StreamInterface[]; | ||
clearStreams(): void; | ||
addDataToStream(type: string, date: Date, data: number): void; | ||
getPositionData(startDate?: Date, endDate?: Date): (DataPositionInterface | null)[]; | ||
clearStreams(): this; | ||
addDataToStream(type: string, date: Date, data: number): this; | ||
getPositionData(startDate?: Date, endDate?: Date, latitudeStream?: StreamInterface, longitudeStream?: StreamInterface): (DataPositionInterface | null)[]; | ||
getSquashedPositionData(startDate?: Date, endDate?: Date, latitudeStream?: StreamInterface, longitudeStream?: StreamInterface): (DataPositionInterface | null)[]; | ||
getLaps(): LapInterface[]; | ||
addLap(lap: LapInterface): void; | ||
addLap(lap: LapInterface): this; | ||
toJSON(): ActivityJSONInterface; | ||
} |
@@ -29,2 +29,11 @@ "use strict"; | ||
_this.streams = []; | ||
if (!startDate || !endDate) { | ||
throw new Error('Start and end dates are required'); | ||
} | ||
if (endDate < startDate) { | ||
throw new Error('Activity end date is before the start date and that is not acceptable'); | ||
} | ||
if (+endDate - +startDate > 12 * 10 * 30 * 24 * 60 * 60 * 1000) { | ||
throw new Error('Activity duration is over 10 years and that is not supported'); | ||
} | ||
_this.type = type; | ||
@@ -39,2 +48,3 @@ _this.creator = creator; | ||
this.getStreamData(type)[Math.ceil((+date - +this.startDate) / 1000)] = value; | ||
return this; | ||
}; | ||
@@ -46,8 +56,11 @@ Activity.prototype.addStream = function (stream) { | ||
this.streams.push(stream); | ||
return this; | ||
}; | ||
Activity.prototype.clearStreams = function () { | ||
this.streams = []; | ||
return this; | ||
}; | ||
Activity.prototype.removeStream = function (stream) { | ||
this.streams = this.streams.filter(function (activityStream) { return stream !== activityStream; }); | ||
return this; | ||
}; | ||
@@ -57,2 +70,3 @@ Activity.prototype.addStreams = function (streams) { | ||
(_a = this.streams).push.apply(_a, streams); | ||
return this; | ||
}; | ||
@@ -78,12 +92,12 @@ Activity.prototype.getAllStreams = function () { | ||
Activity.prototype.getStream = function (streamType) { | ||
var stream = this.streams | ||
var find = this.streams | ||
.find(function (stream) { return stream.type === streamType; }); | ||
if (!stream) { | ||
if (!find) { | ||
throw Error("No stream found with type " + streamType); | ||
} | ||
return stream; | ||
return find; | ||
}; | ||
Activity.prototype.getStreamData = function (streamType, startDate, endDate) { | ||
var _this = this; | ||
var stream = this.getStream(streamType); | ||
var stream = (streamType instanceof stream_1.Stream) ? streamType : this.getStream(streamType); | ||
if (!startDate && !endDate) { | ||
@@ -94,4 +108,4 @@ return stream.data; | ||
return stream.data | ||
.filter(function (value, index) { return (new Date(_this.startDate.getTime() + index * 1000)) >= startDate; }) | ||
.filter(function (value, index) { return (new Date(_this.startDate.getTime() + index * 1000)) <= endDate; }); | ||
.filter(function (value, index) { return (new Date(_this.startDate.getTime() + index * 1000)) <= endDate; }) | ||
.filter(function (value, index) { return (new Date(_this.startDate.getTime() + index * 1000)) >= startDate; }); | ||
} | ||
@@ -109,13 +123,26 @@ if (startDate) { | ||
// @todo see how this fits with the filtering on the stream class | ||
/** | ||
* Gets the data array of an activity stream excluding the non numeric ones | ||
* @todo include strings and all data abstract types | ||
* @param streamType | ||
* @param startDate | ||
* @param endDate | ||
*/ | ||
Activity.prototype.getSquashedStreamData = function (streamType, startDate, endDate) { | ||
return this.getStreamData(streamType, startDate, endDate).filter(function (data) { return helpers_1.isNumber(data); }); | ||
}; | ||
Activity.prototype.getPositionData = function (startDate, endDate) { | ||
var latitudeStreamData = this.getStreamData(data_latitude_degrees_1.DataLatitudeDegrees.type, startDate, endDate); | ||
var longitudeStreamData = this.getStreamData(data_longitude_degrees_1.DataLongitudeDegrees.type, startDate, endDate); | ||
/** | ||
* Combines the lat - long streams to a DataPositionInterface | ||
* @param startDate | ||
* @param endDate | ||
* @param latitudeStream | ||
* @param longitudeStream | ||
*/ | ||
Activity.prototype.getPositionData = function (startDate, endDate, latitudeStream, longitudeStream) { | ||
var latitudeStreamData = latitudeStream ? this.getStreamData(latitudeStream, startDate, endDate) : this.getStreamData(data_latitude_degrees_1.DataLatitudeDegrees.type, startDate, endDate); | ||
var longitudeStreamData = longitudeStream ? this.getStreamData(longitudeStream, startDate, endDate) : this.getStreamData(data_longitude_degrees_1.DataLongitudeDegrees.type, startDate, endDate); | ||
return latitudeStreamData.reduce(function (positionArray, value, index, array) { | ||
// debugger; | ||
var currentLatitude = latitudeStreamData[index]; | ||
var currentLongitude = longitudeStreamData[index]; | ||
if (!currentLatitude || !currentLongitude) { | ||
if (!helpers_1.isNumber(currentLatitude) || !helpers_1.isNumber(currentLongitude)) { | ||
positionArray.push(null); | ||
@@ -131,2 +158,12 @@ return positionArray; | ||
}; | ||
/** | ||
* Combines the lat - long streams to a DataPositionInterface and excludes nulls | ||
* @param startDate | ||
* @param endDate | ||
* @param latitudeStream | ||
* @param longitudeStream | ||
*/ | ||
Activity.prototype.getSquashedPositionData = function (startDate, endDate, latitudeStream, longitudeStream) { | ||
return this.getPositionData(startDate, endDate, latitudeStream, longitudeStream).filter(function (data) { return data !== null; }); | ||
}; | ||
Activity.prototype.getStreamDataTypesBasedOnDataType = function (streamTypeToBaseOn, streamTypes) { | ||
@@ -145,2 +182,3 @@ return event_utilities_1.EventUtilities.getStreamDataTypesBasedOnDataType(this.getStream(streamTypeToBaseOn), this.getAllStreams() | ||
this.laps.push(lap); | ||
return this; | ||
}; | ||
@@ -147,0 +185,0 @@ Activity.prototype.getLaps = function (activity) { |
@@ -5,4 +5,4 @@ import { DataNumber } from './data.number'; | ||
static unit: string; | ||
getDisplayValue(): string; | ||
getDisplayValue(showDays?: boolean): string; | ||
getDisplayUnit(): string; | ||
} |
@@ -22,3 +22,4 @@ "use strict"; | ||
} | ||
DataDuration.prototype.getDisplayValue = function () { | ||
DataDuration.prototype.getDisplayValue = function (showDays) { | ||
if (showDays === void 0) { showDays = false; } | ||
var seconds = this.getValue(); | ||
@@ -37,3 +38,6 @@ var h = Math.floor(seconds / 3600); | ||
if (d) { | ||
return d + 'd ' + ('0' + (h - d * 24)).slice(-2) + 'h ' + ('0' + m).slice(-2) + 'm ' + ('0' + s).slice(-2) + 's'; | ||
if (showDays) { | ||
return d + 'd ' + ('0' + (h - d * 24)).slice(-2) + 'h ' + ('0' + m).slice(-2) + 'm ' + ('0' + s).slice(-2) + 's'; | ||
} | ||
return h + 'h ' + ('0' + m).slice(-2) + 'm ' + ('0' + s).slice(-2) + 's'; | ||
} | ||
@@ -40,0 +44,0 @@ else { |
@@ -90,2 +90,7 @@ "use strict"; | ||
var data_end_altitude_1 = require("./data.end-altitude"); | ||
var data_swim_pace_1 = require("./data.swim-pace"); | ||
var data_swim_pace_avg_1 = require("./data.swim-pace-avg"); | ||
var data_swim_pace_max_1 = require("./data.swim-pace-max"); | ||
var data_swim_pace_min_1 = require("./data.swim-pace-min"); | ||
var data_swolf_avg_1 = require("./data.swolf-avg"); | ||
/** | ||
@@ -151,2 +156,6 @@ * Only concrete classes no abstracts | ||
DataPaceAvg: data_pace_avg_1.DataPaceAvg, | ||
DataSwimPace: data_swim_pace_1.DataSwimPace, | ||
DataSwimPaceMin: data_swim_pace_min_1.DataSwimPaceMin, | ||
DataSwimPaceMax: data_swim_pace_max_1.DataSwimPaceMax, | ||
DataSwimPaceAvg: data_swim_pace_avg_1.DataSwimPaceAvg, | ||
DataNumberOfSamples: data_number_of_samples_1.DataNumberOfSamples, | ||
@@ -196,2 +205,6 @@ DataBatteryCharge: data_battery_charge_1.DataBatteryCharge, | ||
DataPaceMaxMinutesPerMile: data_pace_max_1.DataPaceMaxMinutesPerMile, | ||
DataSwimPaceMinutesPer100Yard: data_swim_pace_1.DataSwimPaceMinutesPer100Yard, | ||
DataSwimPaceAvgMinutesPer100Yard: data_swim_pace_avg_1.DataSwimPaceAvgMinutesPer100Yard, | ||
DataSwimPaceMinMinutesPer100Yard: data_swim_pace_min_1.DataSwimPaceMinMinutesPer100Yard, | ||
DataSwimPaceMaxMinutesPer100Yard: data_swim_pace_max_1.DataSwimPaceMaxMinutesPer100Yard, | ||
DataVerticalSpeedFeetPerSecond: data_vertical_speed_1.DataVerticalSpeedFeetPerSecond, | ||
@@ -235,2 +248,3 @@ DataVerticalSpeedMetersPerMinute: data_vertical_speed_1.DataVerticalSpeedMetersPerMinute, | ||
DataEndAltitude: data_end_altitude_1.DataEndAltitude, | ||
DataSWOLFAvg: data_swolf_avg_1.DataSWOLFAvg, | ||
}; | ||
@@ -296,5 +310,2 @@ var DynamicDataLoader = /** @class */ (function () { | ||
DynamicDataLoader.unitBasedDataTypes = (_a = {}, | ||
_a[data_pace_1.DataPace.type] = [ | ||
data_pace_1.DataPaceMinutesPerMile.type, | ||
], | ||
_a[data_speed_1.DataSpeed.type] = [ | ||
@@ -304,2 +315,8 @@ data_speed_1.DataSpeedKilometersPerHour.type, | ||
data_speed_1.DataSpeedFeetPerSecond.type, | ||
// Pace is also based on speed | ||
data_pace_1.DataPace.type, | ||
data_pace_1.DataPaceMinutesPerMile.type, | ||
// Swim pace as well | ||
data_swim_pace_1.DataSwimPace.type, | ||
data_swim_pace_max_1.DataSwimPaceMaxMinutesPer100Yard.type, | ||
], | ||
@@ -306,0 +323,0 @@ _a[data_vertical_speed_1.DataVerticalSpeed.type] = [ |
@@ -22,13 +22,3 @@ "use strict"; | ||
function DurationClassAbstract(startDate, endDate) { | ||
var _this = this; | ||
if (!startDate || !endDate) { | ||
throw new Error('Start and end dates are required'); | ||
} | ||
if (+endDate - +startDate > 48 * 30 * 24 * 60 * 60 * 1000) { | ||
throw new Error('Activity duration is over 4 years and that is not supported'); | ||
} | ||
if (endDate < startDate) { | ||
throw new Error('Activity end date is before the start date and that is not acceptable'); | ||
} | ||
_this = _super.call(this) || this; | ||
var _this = _super.call(this) || this; | ||
_this.startDate = startDate; | ||
@@ -35,0 +25,0 @@ _this.endDate = endDate; |
@@ -46,2 +46,3 @@ "use strict"; | ||
var data_cadence_min_1 = require("../../../../data/data.cadence-min"); | ||
var data_swolf_avg_1 = require("../../../../data/data.swolf-avg"); | ||
var FitFileParser = require('fit-file-parser').default; | ||
@@ -286,2 +287,6 @@ var EventImporterFIT = /** @class */ (function () { | ||
} | ||
// Average SWOLF | ||
if (helpers_1.isNumberOrString(object.avg_swolf)) { | ||
stats.push(new data_swolf_avg_1.DataSWOLFAvg(object.avg_swolf)); | ||
} | ||
// @todo add support for more data | ||
@@ -288,0 +293,0 @@ return stats; |
@@ -55,2 +55,6 @@ "use strict"; | ||
var data_end_altitude_1 = require("../../data/data.end-altitude"); | ||
var data_swim_pace_max_1 = require("../../data/data.swim-pace-max"); | ||
var data_swim_pace_1 = require("../../data/data.swim-pace"); | ||
var data_swim_pace_min_1 = require("../../data/data.swim-pace-min"); | ||
var data_swim_pace_avg_1 = require("../../data/data.swim-pace-avg"); | ||
var EventUtilities = /** @class */ (function () { | ||
@@ -386,3 +390,3 @@ function EventUtilities() { | ||
&& activity.hasStreamData(data_altitude_1.DataAltitude.type, activity.startDate, activity.endDate)) { | ||
activity.addStat(new data_start_altitude_1.DataStartAltitude(this.getDataTypeLast(activity, data_altitude_1.DataAltitude.type, activity.startDate, activity.endDate))); | ||
activity.addStat(new data_start_altitude_1.DataStartAltitude(this.getDataTypeFirst(activity, data_altitude_1.DataAltitude.type, activity.startDate, activity.endDate))); | ||
} | ||
@@ -392,3 +396,3 @@ // Altitude end | ||
&& activity.hasStreamData(data_altitude_1.DataAltitude.type, activity.startDate, activity.endDate)) { | ||
activity.addStat(new data_end_altitude_1.DataEndAltitude(this.getDataTypeFirst(activity, data_altitude_1.DataAltitude.type, activity.startDate, activity.endDate))); | ||
activity.addStat(new data_end_altitude_1.DataEndAltitude(this.getDataTypeLast(activity, data_altitude_1.DataAltitude.type, activity.startDate, activity.endDate))); | ||
} | ||
@@ -455,2 +459,17 @@ // Heart Rate Max | ||
} | ||
// Swim Pace Max | ||
if (!activity.getStat(data_swim_pace_max_1.DataSwimPaceMax.type) | ||
&& activity.hasStreamData(data_swim_pace_1.DataSwimPace.type, activity.startDate, activity.endDate)) { | ||
activity.addStat(new data_swim_pace_max_1.DataSwimPaceMax(this.getDataTypeMin(activity, data_swim_pace_1.DataSwimPace.type, activity.startDate, activity.endDate))); // Intentionally min | ||
} | ||
// Swim Pace Min | ||
if (!activity.getStat(data_swim_pace_min_1.DataSwimPaceMin.type) | ||
&& activity.hasStreamData(data_swim_pace_1.DataSwimPace.type, activity.startDate, activity.endDate)) { | ||
activity.addStat(new data_swim_pace_min_1.DataSwimPaceMin(this.getDataTypeMax(activity, data_swim_pace_1.DataSwimPace.type, activity.startDate, activity.endDate))); // Intentionally max | ||
} | ||
// Swim Pace Avg | ||
if (!activity.getStat(data_swim_pace_avg_1.DataSwimPaceAvg.type) | ||
&& activity.hasStreamData(data_swim_pace_1.DataSwimPace.type, activity.startDate, activity.endDate)) { | ||
activity.addStat(new data_swim_pace_avg_1.DataSwimPaceAvg(this.getDataTypeAvg(activity, data_swim_pace_1.DataSwimPace.type, activity.startDate, activity.endDate))); | ||
} | ||
// Vertical Speed Max | ||
@@ -515,2 +534,3 @@ if (!activity.getStat(data_vertical_speed_max_1.DataVerticalSpeedMax.type) | ||
EventUtilities.generateMissingUnitStatsForActivity = function (activity) { | ||
// Pace | ||
if (!activity.getStat(data_pace_max_1.DataPaceMaxMinutesPerMile.type)) { | ||
@@ -534,2 +554,22 @@ var paceMax = activity.getStat(data_pace_max_1.DataPaceMax.type); | ||
} | ||
// Swim Pace | ||
if (!activity.getStat(data_swim_pace_max_1.DataSwimPaceMaxMinutesPer100Yard.type)) { | ||
var swimPaceMax = activity.getStat(data_swim_pace_max_1.DataSwimPaceMax.type); | ||
if (swimPaceMax) { | ||
activity.addStat(new data_swim_pace_max_1.DataSwimPaceMaxMinutesPer100Yard(helpers_1.convertSwimPaceToSwimPacePer100Yard(swimPaceMax.getValue()))); | ||
} | ||
} | ||
if (!activity.getStat(data_swim_pace_min_1.DataSwimPaceMinMinutesPer100Yard.type)) { | ||
var swimPaceMin = activity.getStat(data_swim_pace_min_1.DataSwimPaceMin.type); | ||
if (swimPaceMin) { | ||
activity.addStat(new data_swim_pace_min_1.DataSwimPaceMinMinutesPer100Yard(helpers_1.convertSwimPaceToSwimPacePer100Yard(swimPaceMin.getValue()))); | ||
} | ||
} | ||
if (!activity.getStat(data_swim_pace_avg_1.DataSwimPaceAvgMinutesPer100Yard.type)) { | ||
var swimPaceAvg = activity.getStat(data_pace_avg_1.DataPaceAvg.type); | ||
if (swimPaceAvg) { | ||
activity.addStat(new data_swim_pace_avg_1.DataSwimPaceAvgMinutesPer100Yard(helpers_1.convertSwimPaceToSwimPacePer100Yard(swimPaceAvg.getValue()))); | ||
} | ||
} | ||
// Speed | ||
if (!activity.getStat(data_speed_max_1.DataSpeedMaxKilometersPerHour.type)) { | ||
@@ -760,5 +800,7 @@ var speedMax = activity.getStat(data_speed_max_1.DataSpeedMax.type); | ||
var paceStream = streams.find(function (stream) { return stream.type === data_pace_1.DataPace.type; }); | ||
var swimPaceStream = streams.find(function (stream) { return stream.type === data_swim_pace_1.DataSwimPace.type; }); | ||
if (!speedStream) { | ||
return unitStreams; | ||
} | ||
// Pace | ||
if (!paceStream) { | ||
@@ -773,2 +815,12 @@ paceStream = new stream_1.Stream(data_pace_1.DataPace.type, speedStream.data.map(function (dataValue) { | ||
} | ||
// Swim Pace | ||
if (!swimPaceStream) { | ||
swimPaceStream = new stream_1.Stream(data_swim_pace_1.DataSwimPace.type, speedStream.data.map(function (dataValue) { | ||
if (!helpers_1.isNumber(dataValue)) { | ||
return null; | ||
} | ||
return helpers_1.convertSpeedToSwimPace(dataValue); | ||
})); | ||
unitStreams.push(swimPaceStream); | ||
} | ||
// Generate speed in Kilometers per hour | ||
@@ -802,2 +854,9 @@ unitStreams.push(new stream_1.Stream(data_speed_1.DataSpeedKilometersPerHour.type, speedStream.data.map(function (dataValue) { | ||
}))); | ||
// Generate swim pace in minutes per 100 yard | ||
unitStreams.push(new stream_1.Stream(data_swim_pace_1.DataSwimPaceMinutesPer100Yard.type, swimPaceStream.data.map(function (dataValue) { | ||
if (!helpers_1.isNumber(dataValue)) { | ||
return null; | ||
} | ||
return helpers_1.convertSwimPaceToSwimPacePer100Yard(dataValue); | ||
}))); | ||
// If we have more vertical speed data | ||
@@ -804,0 +863,0 @@ if (verticalSpeedStream) { |
export declare function isNumberOrString(property: any): boolean; | ||
export declare function isNumber(property: any): boolean; | ||
/** | ||
* Converts speed from m/s to pace as of seconds | ||
* Converts speed from m/s to pace as of seconds per km | ||
* @param {number} number | ||
@@ -9,2 +9,7 @@ * @return {number} | ||
export declare function convertSpeedToPace(number: number): number; | ||
/** | ||
* Converts m/s to seconds per 100m | ||
* @param number | ||
*/ | ||
export declare function convertSpeedToSwimPace(number: number): number; | ||
export declare function convertSpeedToSpeedInKilometersPerHour(number: number): number; | ||
@@ -18,2 +23,7 @@ export declare function convertSpeedToSpeedInMilesPerHour(number: number): number; | ||
export declare function convertPaceToPaceInMinutesPerMile(number: number): number; | ||
/** | ||
* Converts m/s to seconds per 100m | ||
* @param number | ||
*/ | ||
export declare function convertSwimPaceToSwimPacePer100Yard(number: number): number; | ||
export declare function getSize(obj: any): string; |
@@ -12,3 +12,3 @@ "use strict"; | ||
/** | ||
* Converts speed from m/s to pace as of seconds | ||
* Converts speed from m/s to pace as of seconds per km | ||
* @param {number} number | ||
@@ -21,2 +21,10 @@ * @return {number} | ||
exports.convertSpeedToPace = convertSpeedToPace; | ||
/** | ||
* Converts m/s to seconds per 100m | ||
* @param number | ||
*/ | ||
function convertSpeedToSwimPace(number) { | ||
return number === 0 ? number : (100 / number); | ||
} | ||
exports.convertSpeedToSwimPace = convertSpeedToSwimPace; | ||
function convertSpeedToSpeedInKilometersPerHour(number) { | ||
@@ -54,2 +62,10 @@ return number * 3.6; | ||
exports.convertPaceToPaceInMinutesPerMile = convertPaceToPaceInMinutesPerMile; | ||
/** | ||
* Converts m/s to seconds per 100m | ||
* @param number | ||
*/ | ||
function convertSwimPaceToSwimPacePer100Yard(number) { | ||
return number * 1.93613298; | ||
} | ||
exports.convertSwimPaceToSwimPacePer100Yard = convertSwimPaceToSwimPacePer100Yard; | ||
function getSize(obj) { | ||
@@ -56,0 +72,0 @@ var bytes = 0; |
@@ -13,6 +13,6 @@ /** | ||
'manual' = "Manual", | ||
'Autolap' = "Auto lap", | ||
'AutoLap' = "Auto lap", | ||
'autolap' = "Auto lap", | ||
'Auto lap' = "Auto lap", | ||
'Autolap' = "Autolap", | ||
'AutoLap' = "Autolap", | ||
'autolap' = "Autolap", | ||
'Auto lap' = "Autolap", | ||
'Distance' = "Distance", | ||
@@ -42,3 +42,4 @@ 'distance' = "Distance", | ||
'fitness equipment' = "Fitness equipment", | ||
'Fitness equipment' = "Fitness equipment" | ||
'Fitness equipment' = "Fitness equipment", | ||
'FitnessEquipment' = "Fitness equipment" | ||
} |
@@ -16,6 +16,6 @@ "use strict"; | ||
LapTypes["manual"] = "Manual"; | ||
LapTypes["Autolap"] = "Auto lap"; | ||
LapTypes["AutoLap"] = "Auto lap"; | ||
LapTypes["autolap"] = "Auto lap"; | ||
LapTypes["Auto lap"] = "Auto lap"; | ||
LapTypes["Autolap"] = "Autolap"; | ||
LapTypes["AutoLap"] = "Autolap"; | ||
LapTypes["autolap"] = "Autolap"; | ||
LapTypes["Auto lap"] = "Autolap"; | ||
LapTypes["Distance"] = "Distance"; | ||
@@ -46,2 +46,3 @@ LapTypes["distance"] = "Distance"; | ||
LapTypes["Fitness equipment"] = "Fitness equipment"; | ||
LapTypes["FitnessEquipment"] = "Fitness equipment"; | ||
})(LapTypes = exports.LapTypes || (exports.LapTypes = {})); |
@@ -7,2 +7,6 @@ import { StreamDataItem, StreamInterface } from './stream.interface'; | ||
getNumericData(): number[]; | ||
/** | ||
* Gets the data based on a startDate | ||
* @param startDate | ||
*/ | ||
getStreamDataByTime(startDate: Date): StreamDataItem[]; | ||
@@ -9,0 +13,0 @@ getStreamDataByDuration(offset?: number): StreamDataItem[]; |
@@ -16,2 +16,6 @@ "use strict"; | ||
}; | ||
/** | ||
* Gets the data based on a startDate | ||
* @param startDate | ||
*/ | ||
Stream.prototype.getStreamDataByTime = function (startDate) { | ||
@@ -18,0 +22,0 @@ return this.data.reduce(function (accu, dataItem, index) { |
@@ -5,4 +5,4 @@ export interface UserAppSettingsInterface { | ||
export declare enum AppThemes { | ||
Normal = "normal", | ||
Dark = "dark" | ||
Normal = "Normal", | ||
Dark = "Dark" | ||
} |
@@ -5,4 +5,4 @@ "use strict"; | ||
(function (AppThemes) { | ||
AppThemes["Normal"] = "normal"; | ||
AppThemes["Dark"] = "dark"; | ||
AppThemes["Normal"] = "Normal"; | ||
AppThemes["Dark"] = "Dark"; | ||
})(AppThemes = exports.AppThemes || (exports.AppThemes = {})); |
@@ -6,2 +6,4 @@ export interface UserChartSettingsInterface { | ||
xAxisType: XAxisTypes; | ||
showAllData: boolean; | ||
dataSmoothingLevel: number; | ||
} | ||
@@ -8,0 +10,0 @@ export declare enum ChartThemes { |
@@ -5,3 +5,5 @@ import { UserChartSettingsInterface } from './user.chart.settings.interface'; | ||
import { UserDashboardSettingsInterface } from './user.dashboard.settings.interface'; | ||
import { UserMapSettingsInterface } from './user.map.settings.interface'; | ||
export interface UserSettingsInterface { | ||
mapSettings?: UserMapSettingsInterface; | ||
chartSettings?: UserChartSettingsInterface; | ||
@@ -8,0 +10,0 @@ appSettings?: UserAppSettingsInterface; |
@@ -5,2 +5,3 @@ export interface UserUnitSettingsInterface { | ||
paceUnits: PaceUnits[]; | ||
swimPaceUnits: SwimPaceUnits[]; | ||
startOfTheWeek: DaysOfTheWeek; | ||
@@ -28,2 +29,6 @@ } | ||
} | ||
export declare enum SwimPaceUnits { | ||
MinutesPer100Meter = "Swim Pace", | ||
MinutesPer100Yard = "Swim Pace in minutes per 100 yard" | ||
} | ||
export declare enum DaysOfTheWeek { | ||
@@ -30,0 +35,0 @@ Sunday = 0, |
@@ -28,2 +28,7 @@ "use strict"; | ||
})(PaceUnits = exports.PaceUnits || (exports.PaceUnits = {})); | ||
var SwimPaceUnits; | ||
(function (SwimPaceUnits) { | ||
SwimPaceUnits["MinutesPer100Meter"] = "Swim Pace"; | ||
SwimPaceUnits["MinutesPer100Yard"] = "Swim Pace in minutes per 100 yard"; | ||
})(SwimPaceUnits = exports.SwimPaceUnits || (exports.SwimPaceUnits = {})); | ||
var DaysOfTheWeek; | ||
@@ -30,0 +35,0 @@ (function (DaysOfTheWeek) { |
{ | ||
"name": "quantified-self-lib", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"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 @@ "keywords": [ |
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
554119
444
11811