New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/flip

Package Overview
Dependencies
Maintainers
4
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/flip - npm Package Compare versions

Comparing version 4.7.3 to 5.0.4

main.js

16

index.d.ts

@@ -1,10 +0,8 @@

/// <reference types="geojson" />
import { AllGeoJSON } from '@turf/helpers'
type Feature = GeoJSON.Feature<any>;
type Features = GeoJSON.FeatureCollection<any>;
type Geometry = GeoJSON.GeometryObject;
type Geometries = GeoJSON.GeometryCollection;
declare function flip<T extends Features|Feature|Geometry|Geometries>(geojson: T, mutate?: boolean): T
declare namespace flip { }
export = flip;
export default function flip<T extends AllGeoJSON>(
geojson: T,
options?: {
mutate?: boolean
}
): T

@@ -1,2 +0,4 @@

var coordEach = require('@turf/meta').coordEach;
import { coordEach } from '@turf/meta';
import { isObject } from '@turf/helpers';
import clone from '@turf/clone';

@@ -7,5 +9,6 @@ /**

* @name flip
* @param {FeatureCollection|Feature<any>} geojson input features
* @param {boolean} [mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
* @returns {FeatureCollection|Feature<any>} a feature or set of features of the same type as `input` with flipped coordinates
* @param {GeoJSON} geojson input features
* @param {Object} [options={}] Optional parameters
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
* @returns {GeoJSON} a feature or set of features of the same type as `input` with flipped coordinates
* @example

@@ -19,3 +22,8 @@ * var serbia = turf.point([20.566406, 43.421008]);

*/
module.exports = function (geojson, mutate) {
function flip(geojson, options) {
// Optional parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
var mutate = options.mutate;
if (!geojson) throw new Error('geojson is required');

@@ -25,3 +33,3 @@ // ensure that we don't modify features in-place and changes to the

// properties.
if (mutate === false || mutate === undefined) geojson = JSON.parse(JSON.stringify(geojson));
if (mutate === false || mutate === undefined) geojson = clone(geojson);

@@ -35,2 +43,4 @@ coordEach(geojson, function (coord) {

return geojson;
};
}
export default flip;
{
"name": "@turf/flip",
"version": "4.7.3",
"version": "5.0.4",
"description": "turf flip module",
"main": "index.js",
"main": "main",
"module": "index",
"jsnext:main": "index",
"types": "index.d.ts",
"files": [
"index.js",
"index.d.ts"
"index.d.ts",
"main.js"
],
"scripts": {
"test": "node test.js",
"bench": "node bench.js"
"pretest": "rollup -c ../../rollup.config.js",
"test": "node -r @std/esm test.js",
"bench": "node -r @std/esm bench.js"
},

@@ -32,11 +36,18 @@ "repository": {

"devDependencies": {
"@turf/helpers": "^4.7.3",
"benchmark": "^2.1.4",
"load-json-file": "^2.0.0",
"tape": "^4.6.3",
"write-json-file": "^2.0.0"
"@std/esm": "*",
"benchmark": "*",
"load-json-file": "*",
"rollup": "*",
"tape": "*",
"write-json-file": "*"
},
"dependencies": {
"@turf/meta": "^4.7.3"
"@turf/clone": "^5.0.4",
"@turf/helpers": "^5.0.4",
"@turf/meta": "^5.0.4"
},
"@std/esm": {
"esm": "js",
"cjs": true
}
}
# @turf/flip
# flip
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## flip
Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`.

@@ -9,4 +11,5 @@

- `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;any>)** input features
- `mutate` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
- `geojson` **[GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects)** input features
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`)
- `options.mutate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)

@@ -24,3 +27,3 @@ **Examples**

Returns **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;any>)** a feature or set of features of the same type as `input` with flipped coordinates
Returns **[GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects)** a feature or set of features of the same type as `input` with flipped coordinates

@@ -27,0 +30,0 @@ <!-- This file is automatically generated. Please don't edit it directly:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc