Skip to content

Commit

Permalink
Rename geojson to feature (prevents any confusion)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere authored Aug 14, 2017
1 parent 405f47f commit 671b34d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/turf-transform-scale/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ module.exports = function (geojson, factor, origin, mutate) {
* Scale Feature/Geometry
*
* @private
* @param {Feature|Geometry} geojson GeoJSON Feature/Geometry
* @param {Feature|Geometry} feature GeoJSON Feature/Geometry
* @param {number} factor of scaling, positive or negative values greater than 0
* @param {string|Geometry|Feature<Point>|Array<number>} [origin="centroid"] Point from which the scaling will occur (string options: sw/se/nw/ne/center/centroid)
* @returns {Feature|Geometry} scaled GeoJSON Feature/Geometry
*/
function scale(geojson, factor, origin) {
function scale(feature, factor, origin) {
// Default params
var isPoint = getGeomType(geojson) === 'Point';
origin = defineOrigin(geojson, origin);
var isPoint = getGeomType(feature) === 'Point';
origin = defineOrigin(feature, origin);

// Shortcut no-scaling
if (factor === 1 || isPoint) return geojson;
if (factor === 1 || isPoint) return feature;

// Scale each coordinate
coordEach(geojson, function (coord) {
coordEach(feature, function (coord) {
var originalDistance = rhumbDistance(origin, coord);
var bearing = rhumbBearing(origin, coord);
var newDistance = originalDistance * factor;
Expand All @@ -82,7 +82,7 @@ function scale(geojson, factor, origin) {
if (coord.length === 3) coord[2] *= factor;
});

return geojson;
return feature;
}

/**
Expand Down

0 comments on commit 671b34d

Please sign in to comment.