New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sparc-commons

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparc-commons - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

14

libs/geoservice.js

@@ -141,3 +141,3 @@ /*jshint multistr: true */

var diffLon = coordCur.lon - coordPrev.lon
return [diffLat < 0, diffLon < 0]
return [diffLon < 0, diffLat < 0]
}

@@ -181,4 +181,6 @@

var splicePoint = es.splicePoint = (segment, point) => {
if(_.isUndefined(segment) || segment.length < 2){
throw Error('Cannot process a segment with less than two coordinates')
if(segment.length < 2){
//points are always contained in the segment
segment.unshift(point)
return 0
}

@@ -202,3 +204,7 @@

var isBetween = closest[1].isBetween || calculateQuadrant(closest[1].coords, closest[0].coords)
var isBetween = closest[1].isBetween
if(_.isNull(isBetween)){
isBetween = calculateQuadrant(closest[1].coords, closest[0].coords)
}
if(isBetween(trend)){

@@ -205,0 +211,0 @@ segment.splice(closest[0].index + 1, 0, point)

{
"name": "sparc-commons",
"version": "0.2.9",
"version": "0.2.10",
"description": "Library with all small time common stuff used across the SPARC echosystem",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -90,4 +90,62 @@ var chai = require('chai')

it.only("Avoiding Empty segments on optimized spliceSegment", () => {
var segment =[
[ 4.90838741, 52.36030635 ],
[ 4.90833015, 52.36029264 ],
[ 4.90821786, 52.36026247 ],
[ 4.90820045, 52.36025424 ],
[ 4.90819259, 52.36025149 ],
[ 4.90795285, 52.36015549 ],
[ 4.90769852, 52.36001834 ],
[ 4.90663907, 52.35944779 ],
[ 4.90611131, 52.35923109 ]
]
var waypoints = [
{
x: 4.907777,
y: 52.36022,
id: '39ab8c97-3df0-4774-97d2-80165552d254'
},{
x: 4.906277,
y: 52.3593,
id: '39ab8c97-3df0-4774-97d2-80165552d254'
}, {
x: 4.906147,
y: 52.359245,
id: '44f5b4b5-9af8-40d8-9f0b-9b5d5b098995'
}, {
x: 4.906141,
y: 52.35924,
id: 'd3ee52bd-d0d1-49ce-85a9-514f67b448f3'
} ]
var ordered = geo.spliceSegment(segment, waypoints, {sequential: false})
var expected = [
[ 4.90838741, 52.36030635 ],
[ 4.90833015, 52.36029264 ],
[ 4.90821786, 52.36026247 ],
[ 4.90820045, 52.36025424 ],
[ 4.90819259, 52.36025149 ],
[ 4.90795285, 52.36015549 ],
[ 4.907777, 52.36022],
[ 4.90769852, 52.36001834 ],
[ 4.90663907, 52.35944779 ],
[ 4.906277, 52.3593 ],
[ 4.906147, 52.359245 ],
[ 4.906141, 52.35924 ],
[ 4.90611131, 52.35923109 ]
]
_.each(_.zip(ordered, expected), _.spread((result, exp) => {
if(result.x) {
result = [result.x, result.y]
}
expect(result).to.deep.equal(exp)
}))
})
it("Real-life (buggy) segment progression", function(){
var segment = [
[ 4.920315, 52.363037 ],
[ 4.92031479, 52.36303553 ],

@@ -100,2 +158,3 @@ [ 4.92027212, 52.36301908 ],

[ 4.91936988, 52.36244308 ],
[ 4.9190264, 52.36223 ],
[ 4.91902627, 52.36222914 ],

@@ -108,4 +167,8 @@ [ 4.91871523, 52.362092 ],

[ 4.91694274, 52.36187805 ],
[ 4.9169106, 52.361877 ],
[ 4.91650762, 52.36184788 ],
[ 4.91625553, 52.36181222 ],
[ 4.9156775, 52.361664 ],
[ 4.91569, 52.361668 ],
[ 4.91566, 52.36166 ],
[ 4.91543863, 52.36160376 ],

@@ -120,2 +183,3 @@ [ 4.9153589, 52.36158182 ],

[ 4.9145987, 52.36138159 ],
[ 4.914374, 52.361332 ],
[ 4.91412765, 52.36127736 ],

@@ -126,3 +190,3 @@ [ 4.91351343, 52.3611841 ],

[ 4.91190993, 52.36102775 ],
[ 4.91166233, 52.36092078 ]
[ 4.91166233, 52.36092078 ]
]

@@ -129,0 +193,0 @@

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