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

geo-util

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geo-util - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

dist/point.js

14

dist/index.js

@@ -1,1 +0,13 @@

"use strict";
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _point = require('./point');
var point = _interopRequireWildcard(_point);
exports.point = point;

4

lib/index.js
import * as point from './point'
export fun
export {
point
}
import ngeohash from 'ngeohash'
export function clusterByGeohash(points, geohashLevel, reducer) {
const result = []
const geohashes = {}
for (let i = 0, l = points.geometries.length; i < l; i++) {
const point = points.geometries[i]
const geohash = ngeohash.encode(point.lat, point.lng, geohashLevel)
if (geohashes[geohash]) {
geohashes[geohash] = reducer(geohashes[geohash], point)
} else {
geohashes[geohash] = reducer(null, point)
export default {
clusterByGeohash(points, geohashLevel, reducer) {
const result = []
const geohashes = {}
for (let i = 0, l = points.geometries.length; i < l; i++) {
const point = points.geometries[i]
const geohash = ngeohash.encode(point.lat, point.lng, geohashLevel)
if (geohashes[geohash]) {
geohashes[geohash] = reducer(geohashes[geohash], point)
} else {
geohashes[geohash] = reducer(null, point)
}
}
}
for (let geohash in geohashes) {
const {latitude, longitude} = ngeohash.decode(geohash)
result.push({
...geohashes[geohash],
lat: latitude,
lng: longitude,
})
}
return result
}
for (let geohash in geohashes) {
const {latitude, longitude} = ngeohash.decode(geohash)
result.push({
...geohashes[geohash],
lat: latitude,
lng: longitude,
})
}
return result
},
}
{
"name": "geo-util",
"version": "0.0.3",
"version": "0.0.4",
"description": "geo-util for eye",

@@ -14,4 +14,3 @@ "author": "xiagan <huikang.whk@alibaba-inc.com>",

"test": "make test",
"prepublish": "make test-cov && make release",
"postinstall": "make release"
"prepublish": "make test-cov && make release"
},

@@ -31,6 +30,3 @@ "dependencies": {

"node >=0.10.7"
],
"scripts": {
"test": "make test"
}
]
}
import e from 'expect.js'
import ngeohash from 'ngeohash'
import {clusterByGeohash} from '../lib/point'
import point from '../lib/point'

@@ -38,3 +38,3 @@ describe('point', () => {

const geometries = points.geometries
const results = clusterByGeohash(points, 6, (prev, curr) => {
const results = point.clusterByGeohash(points, 6, (prev, curr) => {
if (prev == null) return {...curr, properties: {...curr.properties, num: 1}}

@@ -41,0 +41,0 @@ const result = {...prev}

Sorry, the diff of this file is not supported yet

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