Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quantified-self-lib

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quantified-self-lib - npm Package Compare versions

Comparing version 1.0.0-pre-5 to 1.0.0-pre-6

lib/events/adapters/importers/gpx/importer.gpx.d.ts

3

lib/data/data.js

@@ -6,2 +6,5 @@ "use strict";

function Data(value) {
if ((typeof value !== 'string') && (typeof value !== 'number') && (typeof value !== 'boolean')) {
throw new Error('Value is not boolean or number or string ');
}
this.value = value;

@@ -8,0 +11,0 @@ }

2

lib/events/adapters/importers/importer.gpx.js

@@ -21,3 +21,3 @@ "use strict";

export class EventImporterGPX {
static getFromXML(xml: Document, id?: string): EventInterface {
static getFromString(xml: Document, id?: string): EventInterface {
const event = new Event();

@@ -24,0 +24,0 @@ event.setID(id || event.getID());

@@ -15,3 +15,4 @@ import { EventInterface } from '../event.interface';

private static generateStatsForActivityOrLap(event, subject);
static getDistanceInMeters(event: EventInterface, startDate?: Date, endDate?: Date, activities?: ActivityInterface[]): number;
}
export declare function isNumberOrString(property: any): boolean;

@@ -38,2 +38,3 @@ "use strict";

var data_descent_1 = require("../../data/data.descent");
var geolib_adapter_1 = require("../../geodesy/adapters/geolib.adapter");
var EventUtilities = /** @class */ (function () {

@@ -93,2 +94,3 @@ function EventUtilities() {

event.getActivities().map(function (activity) {
// Generate for activities
_this.generateStatsForActivityOrLap(event, activity);

@@ -107,3 +109,3 @@ activity.getLaps().map(function (lap) {

EventUtilities.getEventDataTypeGainOrLoss = function (gain, event, dataType, starDate, endDate, activities, minDiff) {
if (minDiff === void 0) { minDiff = 3.1; }
if (minDiff === void 0) { minDiff = 1; }
var gainOrLoss = 0;

@@ -161,2 +163,14 @@ var points = event.getPoints(starDate, endDate, activities);

EventUtilities.generateStatsForActivityOrLap = function (event, subject) {
// If there is no duration define that from the start date and end date
if (!subject.getStat(data_duration_1.DataDuration.className)) {
subject.addStat(new data_duration_1.DataDuration((subject.endDate.getTime() - subject.startDate.getTime()) / 1000));
}
// If there is no pause define that from the start date and end date and duration
if (!subject.getStat(data_pause_1.DataPause.className)) {
subject.addStat(new data_pause_1.DataPause(((subject.endDate.getTime() - subject.startDate.getTime()) / 1000) - subject.getDuration().getValue()));
}
// If there is no distance
if (!subject.getStat(data_distance_1.DataDistance.className)) {
subject.addStat(new data_distance_1.DataDistance(this.getDistanceInMeters(event, subject.startDate, subject.endDate)));
}
// Ascent (altitude gain)

@@ -277,2 +291,5 @@ if (!subject.getStat(data_ascent_1.DataAscent.className)

};
EventUtilities.getDistanceInMeters = function (event, startDate, endDate, activities) {
return (new geolib_adapter_1.GeoLibAdapter()).getDistance(event.getPointsWithPosition(startDate, endDate, activities));
};
return EventUtilities;

@@ -279,0 +296,0 @@ }());

{
"name": "quantified-self-lib",
"version": "1.0.0-pre-5",
"description": "A utility lib to work with tcx, fit and Suunto files",
"version": "1.0.0-pre-6",
"description": "A utility lib to work with gpx, tcx, fit and Suunto files",
"main": "lib/index.js",

@@ -27,2 +27,3 @@ "types": "lib/index.d.ts",

"geolib": "^2.0.24",
"gxparser": "^1.0.0",
"lowpassf": "^0.5.0",

@@ -29,0 +30,0 @@ "moving-median": "^1.0.0",

@@ -5,2 +5,3 @@ # Quantified Self Lib

[![codebeat badge](https://codebeat.co/badges/e99f7c8a-3b7a-4d5b-9034-2dfd38c0e0a3)](https://codebeat.co/projects/github-com-jimmykane-quantified-self-develop)
[![Build Status](https://travis-ci.org/jimmykane/quantified-self-lib.svg?branch=master)](https://travis-ci.org/jimmykane/quantified-self-lib.svg?branch=master)

@@ -7,0 +8,0 @@ [![codecov](https://codecov.io/gh/jimmykane/quantified-self-lib/branch/master/graph/badge.svg)](https://codecov.io/gh/jimmykane/quantified-self)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc