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

geokit

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geokit - npm Package Compare versions

Comparing version 0.0.1-dev.20171001T164020000Z.43a3cc4 to 0.0.1-dev.20180308T002701000Z.250cda0

tests/geokit.test.ts

10

dist/geokit.d.ts

@@ -40,2 +40,12 @@ import { LatLngLiteral } from './interfaces';

private _toRad(degrees);
/**
* Validates user inputted coordinates.
* @param coordinates User inputted coordinates.
* @returns Error.
*/
private _validateCoordinates(coordinates);
}
/**
* Instantiated Geokit object.
*/
export declare const geokit: Geokit;

@@ -25,2 +25,10 @@ "use strict";

Geokit.prototype.distance = function (start, end, unit) {
var startValid = this._validateCoordinates(start);
if (startValid instanceof Error) {
throw new Error('Start coordinates: ' + startValid.message);
}
var endValid = this._validateCoordinates(end);
if (endValid instanceof Error) {
throw new Error('End coordinates: ' + endValid.message);
}
var radius = (unit === 'miles') ? 3963 : 6371;

@@ -44,2 +52,6 @@ var dLat = this._toRad(end.lat - start.lat);

if (precision === void 0) { precision = 10; }
var valid = this._validateCoordinates(coordinates);
if (valid instanceof Error) {
throw valid;
}
var hash = '';

@@ -80,4 +92,31 @@ var latRng = [-90, 90];

};
/**
* Validates user inputted coordinates.
* @param coordinates User inputted coordinates.
* @returns Error.
*/
Geokit.prototype._validateCoordinates = function (coordinates) {
var error = [];
if (coordinates.lat > 90) {
error.push('Your latitude is greater than 90°');
}
if (coordinates.lat < -90) {
error.push('Your latitude is less than -90°');
}
if (coordinates.lng > 180) {
error.push('Your longitude is greater than 180°');
}
if (coordinates.lng < -180) {
error.push('Your longitude is less than -180°');
}
if (error.length !== 0) {
return new Error(error.join(' '));
}
};
return Geokit;
}());
exports.Geokit = Geokit;
/**
* Instantiated Geokit object.
*/
exports.geokit = new Geokit();

2

dist/index.d.ts

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

export * from './geokit';
export { geokit } from './geokit';
export * from './interfaces';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./geokit"));
var geokit_1 = require("./geokit");
exports.geokit = geokit_1.geokit;

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

{"name":"geokit","version":"0.0.1-dev.20171001T164020000Z.43a3cc4","description":"An assortment of geolocation related tools, all packaged in one easy to use kit.","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"build":"tsc","docs":"typedoc --module node --target es5 --out docs/ src/","start":"npm run build","release:major":"npm run build && changelog -M && git add . && git commit -m 'chore(release): major version release' && npm version major && git push origin && git push origin --tags","release:minor":"npm run build && changelog -m && git add . && git commit -m 'chore(release): minor version release' && npm version minor && git push origin && git push origin --tags","release:patch":"npm run build && changelog -p && git add . && git commit -m 'chore(release): patch version release' && npm version patch && git push origin && git push origin --tags"},"repository":{"type":"git","url":"git+https://github.com/MichaelSolati/geokit.git"},"keywords":["geo","coordinates","geohash"],"author":"Michael Solati","license":"ISC","bugs":{"url":"https://github.com/MichaelSolati/geokit/issues"},"homepage":"https://github.com/MichaelSolati/geokit#readme","devDependencies":{"firebase-tools":"^3.12.0","generate-changelog":"^1.5.0","typedoc":"^0.8.0","typescript":"^2.5.3"}}
{"name":"geokit","version":"0.0.1-dev.20180308T002701000Z.250cda0","description":"An assortment of geolocation related tools, all packaged in one easy to use kit.","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"build":"tsc","docs":"typedoc --module node --target es5 --out docs/ src/","test":"mocha --reporter spec --require ts-node/register 'tests/**/*.test.ts'","start":"npm run build","release:major":"npm run build && changelog -M && git add . && git commit -m 'chore(release): major version release' && npm version major && git push origin && git push origin --tags","release:minor":"npm run build && changelog -m && git add . && git commit -m 'chore(release): minor version release' && npm version minor && git push origin && git push origin --tags","release:patch":"npm run build && changelog -p && git add . && git commit -m 'chore(release): patch version release' && npm version patch && git push origin && git push origin --tags"},"repository":{"type":"git","url":"git+https://github.com/MichaelSolati/geokit.git"},"keywords":["geo","coordinates","geohash"],"author":"Michael Solati","license":"ISC","bugs":{"url":"https://github.com/MichaelSolati/geokit/issues"},"homepage":"https://github.com/MichaelSolati/geokit#readme","devDependencies":{"@types/chai":"^4.1.2","@types/mocha":"^2.2.48","chai":"^4.1.2","firebase-tools":"^3.12.0","generate-changelog":"^1.5.0","mocha":"^5.0.4","ts-node":"^5.0.1","typedoc":"^0.8.0","typescript":"^2.5.3"}}
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