Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geojson-project

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojson-project - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

dist/index.d.ts

24

package.json
{
"name": "geojson-project",
"version": "1.0.1",
"version": "2.0.0",
"description": "Util for processing geojson coordinates, in most cases to project them",
"main": "index.js",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.mjs",
"browser": "dist/index.umd.js",
"jsdelivr": "dist/index.umd.js",
"unpkg": "dist/index.umd.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"test": "tape test.js"
"test": "node --test",
"build": "vite build && npm run types",
"types": "tsc --emitDeclarationOnly --declaration --declarationDir dist index.ts"
},

@@ -26,4 +37,9 @@ "repository": {

"devDependencies": {
"tape": "^4.4.0"
"typescript": "^4.9.4",
"vite": "^4.0.4",
"@types/geojson": "^7946.0.10"
},
"dependencies": {
"@types/geojson": "^7946.0.10"
}
}

66

Readme.md

@@ -1,38 +0,45 @@

# geojson-project [![npm version](https://badge.fury.io/js/geojson-project.svg)](https://badge.fury.io/js/geojson-project) ![circle](https://circleci.com/gh/w8r/geojson-project.svg?style=shield&circle-token=597a6db31df1e249a8a9bf29531f7baefc142641)
# geojson-project [![npm version](https://badge.fury.io/js/geojson-project.svg)](https://badge.fury.io/js/geojson-project)
## API
*`geojsonProject(geojson, func, context)`*
* `geojson` is `Feature` or `FeatureCollection`
* `func` is the project function, takes in one coordinate pair,
returns it transformed
* `context` _optional_ - transform function's `this`
_`geojsonProject(geojson, func, context)`_
- `geojson` is `Feature` or `FeatureCollection`
- `func` is the project function, takes in one coordinate pair,
returns it transformed
- `context` _optional_ - transform function's `this`
returns transformed copy of GeoJSON
## Usage
```js
var geojsonProject = require('geojson-project');
var geojsonProject = require("geojson-project");
geojsonProject({
type: 'FeatureCollection',
features: [{
type: 'Feature',
properties: {a : 1},
geometry: {
type: 'Point',
coordinates: [6, 6]
}
}, {
type: 'Feature',
properties: {a : 2},
geometry: {
type: 'Point',
coordinates: [4, 4]
}
}]
}, function(coord) {
return [coords[0]/2, coords[1]/2];
});
geojsonProject(
{
type: "FeatureCollection",
features: [
{
type: "Feature",
properties: { a: 1 },
geometry: {
type: "Point",
coordinates: [6, 6],
},
},
{
type: "Feature",
properties: { a: 2 },
geometry: {
type: "Point",
coordinates: [4, 4],
},
},
],
},
function (coord) {
return [coords[0] / 2, coords[1] / 2];
}
);
```

@@ -69,3 +76,2 @@

## License

@@ -75,3 +81,3 @@

Copyright (c) 2016 Alexander Milevski
Copyright (c) 2023 Alexander Milevski

@@ -78,0 +84,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

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