<commit_before>var pol = require('turf-polygon');

/**
* turf.rewind
* Function that makes outer ring clockwise and inner rings counterclockwise to meet some cases standards
* Uses [Shoelace Formula]{@link http://en.wikipedia.org/wiki/Shoelace_formula}
* @param {Feature<(Polygon)>} poly - single Polygon Feature
* @param {Boolean} reversed - if you want reversed winding
* @return {Feature<(Polygon)>} 
* @author   <NAME>
* @version 1.0.0
*/
module.exports = function(poly, reversed) {
	if (poly.geometry === void 0 || poly.geometry.type !== 'Polygon' ) throw('"turf-rewind" only accepts polygon type input');
	reversed = (reversed =! void 0)? reversed : false;
	var 
		coor = poly.geometry.coordinates.slice(),
		isClockWise = function(latlngs){
			var cw = 0;
			for (var i=0;i<latlngs.length-1;i++){
				cw += (latlngs[i+1][0]-latlngs[i][0])*(latlngs[i+1][1]+latlngs[i][1]);
			}
			return cw > 0;
		};
	if (isClockWise(coor[0]) == reversed ) coor[0].reverse();		// outer ring
	for(var i=1; i< coor.length; i++){
		if (isClockWise(coor[i]) != reversed ) coor[i].reverse();	// inner rings
	}
	 return pol(coor, poly.properties);
}<commit_msg>Update index.js<commit_after>var pol = require('turf-polygon');

/**
* turf.rewind
* Function that makes outer ring clockwise and inner rings counterclockwise to meet some cases standards
* Uses [Shoelace Formula]{@link http://en.wikipedia.org/wiki/Shoelace_formula}
* @param {Feature<(Polygon)>} poly - single Polygon Feature
* @param {Boolean} reversed - if you want reversed winding
* @return {Feature<(Polygon)>} 
* @author   <NAME>
* @version 1.0.0
*/
module.exports = function(poly, reversed) {
	if (poly.geometry === void 0 || poly.geometry.type !== 'Polygon' ) throw('"turf-rewind" only accepts polygon type input');
	reversed = (reversed =! void 0)? reversed : false;
	var 
		coor = poly.geometry.coordinates.slice(),
		isClockWise = function(latlngs){
			return 0 < latlngs.reduce(function(a,b,c,d){return a + ((c < d.length - 1) ? (d[c+1][0] - b[0]) * (d[c+1][1] + b[1]) : 0)},0);
		};
	if (isClockWise(coor[0]) == reversed ) coor[0].reverse();		// outer ring
	for(var i=1; i< coor.length; i++){
		if (isClockWise(coor[i]) != reversed ) coor[i].reverse();	// inner rings
	}
	 return pol(coor, poly.properties);
}
{'fraction_non_alphanumeric': 0.18033509700176367, 'fraction_numerical': 0.015873015873015872, 'mean_word_length': 4.520681265206813, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3642130', 'n_tokens_mistral': 892, 'n_tokens_neox': 821, 'n_words': 202}