sparc-commons
Advanced tools
Comparing version 0.2.14 to 0.2.15
@@ -241,3 +241,5 @@ /*jshint multistr: true */ | ||
var proximity = distance([coordinates, convPoint]).dist | ||
segment[index] = coordinates | ||
if(transformation){ | ||
segment[index] = coordinates | ||
} | ||
acc.push({ | ||
@@ -270,2 +272,7 @@ index: index, | ||
var transformation = _.get(opts, 'transformation') | ||
if((_.isUndefined(points) || _.isEmpty(points)) && transformation){ | ||
return _.map(segment, point => { | ||
return transform(point, transformation) | ||
}) | ||
} | ||
@@ -272,0 +279,0 @@ return _.reduce(points, (seg, point) => { |
{ | ||
"name": "sparc-commons", | ||
"version": "0.2.14", | ||
"version": "0.2.15", | ||
"description": "Library with all small time common stuff used across the SPARC echosystem", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -248,2 +248,35 @@ var chai = require('chai') | ||
it("Test only the transformation", () => { | ||
var segment = [ | ||
[ 4.89273034, 52.35724234 ], | ||
[ 4.8926523, 52.35665804 ] | ||
] | ||
var expected = [ | ||
{ | ||
type: 'Feature', | ||
properties: { | ||
}, | ||
geometry: { | ||
type: "Point", | ||
coordinates: [ 4.89273034, 52.35724234 ] | ||
} | ||
}, | ||
{ | ||
type: 'Feature', | ||
properties: { | ||
}, | ||
geometry: { | ||
type: "Point", | ||
coordinates: [ 4.8926523, 52.35665804 ] | ||
} | ||
} | ||
] | ||
var ordered = geo.spliceSegment(segment, [], {transformation: "geojson"}) | ||
_.each(_.zip(ordered, expected), _.spread((p, e) => { | ||
expect(p).to.deep.equal(e) | ||
})) | ||
}) | ||
it.skip("Segment progression with Sequential:true", function(){ | ||
@@ -250,0 +283,0 @@ var segment = [ |
46584
1131