@turf/clean-coords #1217

HTML

<script src="https://npmcdn.com/@turf/[email protected]/turf.min.js"></script>
<div id="output"></div>

JavaScript

const result = turf.cleanCoords({"type": "Feature","properties": {},"geometry": {"type": "Polygon","coordinates": [[
[31.6729, 28.9457],
[31.6779, 28.964],
[31.682, 28.981]
]]}});

display(result);


/* output function */
function display(data, target) {
	target = target || 'output';
  var el = document.getElementById(target);
  // if not available create target element
  if (!el) {
  	el = document.createElement('div');
    el.setAttribute("id", target);
    document.body.appendChild(el);
  }
  // inject text
	var json = JSON.stringify(data, null, '\t');
  document.getElementById(target).innerHTML = json;
}