@turf/truncate
Advanced tools
Comparing version 3.10.0 to 3.10.5
28
index.js
@@ -1,2 +0,2 @@ | ||
var deepSlice = require('deep-slice'); | ||
'use strict'; | ||
@@ -27,3 +27,3 @@ /** | ||
*/ | ||
module.exports = function (layer, precision, coordinates) { | ||
var index_es6 = function (layer, precision, coordinates) { | ||
precision = precision || 6; | ||
@@ -60,1 +60,25 @@ coordinates = coordinates || 2; | ||
} | ||
/** | ||
* Recursive Array.prototype.slice() | ||
* https://github.com/DenisCarriere/deep-slice | ||
* | ||
* @private | ||
* @param {Array} items Array input | ||
* @param {number} start The beginning of the specified portion of the array. | ||
* @param {number} end The end of the specified portion of the array. | ||
* @returns {Array} Returns a section of an array. | ||
* @example | ||
* deepSlice([[10, 20, 30], [40, 50, 60]], 0, 2) | ||
* //=[[10, 20], [40, 50]] | ||
*/ | ||
function deepSlice(items, start, end) { | ||
if (typeof items[0] !== 'object') { | ||
return items.slice(start, end); | ||
} | ||
return items.map(function (item) { | ||
return deepSlice(item, start, end); | ||
}); | ||
} | ||
module.exports = index_es6; |
{ | ||
"name": "@turf/truncate", | ||
"version": "3.10.0", | ||
"version": "3.10.5", | ||
"description": "Truncates the geometry precision for all GeoJSON coordinates.", | ||
"main": "index.js", | ||
"jsnext:main": "index.es6.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"index.js", | ||
"index.es6.js", | ||
"index.d.ts" | ||
], | ||
"scripts": { | ||
"test": "node test.js" | ||
"test": "node test.js", | ||
"pretest": "npm run rollup", | ||
"rollup": "rollup -c rollup.config.js" | ||
}, | ||
@@ -14,6 +22,2 @@ "repository": { | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
@@ -31,13 +35,10 @@ "turf", | ||
"homepage": "https://github.com/Turfjs/turf", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"benchmark": "^1.0.0", | ||
"eslint": "^3.14.1", | ||
"eslint-config-mourner": "^2.0.1", | ||
"load-json-file": "^2.0.0", | ||
"rollup": "^0.41.4", | ||
"tape": "^3.5.0", | ||
"write-json-file": "^2.0.0" | ||
}, | ||
"dependencies": { | ||
"deep-slice": "^1.1.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
9260
0
5
6
158
- Removeddeep-slice@^1.1.2
- Removeddeep-slice@1.1.4(transitive)