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

ng2-haversine

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-haversine - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "ng2-haversine",
"version": "0.1.0",
"version": "0.1.1",
"description": "An Angular 2 library to calculate the distance between a pair of coordinates using the Haversine formula.",

@@ -5,0 +5,0 @@ "repository": {

@@ -14,3 +14,3 @@ # ng2-haversine

```bash
$ npm instal ng2-haversine --save
$ npm install ng2-haversine --save
```

@@ -46,6 +46,7 @@

Then, use some of the provided functions in `HaversineService` to calcule the distance between two points:
Then, use one of the provided functions in `HaversineService` to calcule the distance between two points:
```typescript
tryHaversine(): void {
let madrid: GeoCoord = {

@@ -55,2 +56,3 @@ latitude: 40.416775,

};
let bilbao: GeoCoord = {

@@ -60,5 +62,7 @@ latitude: 43.262985,

};
let meters = this._haversineService.getDistanceInMeters(madrid, bilbao);
let kilometers = this._haversineService.getDistanceInKilometers(madrid, bilbao);
let miles = this._haversineService.getDistanceInMiles(madrid, bilbao);
console.log(`

@@ -73,5 +77,12 @@ The distance between Madrid and Bilbao is:

As you have guessed:
- `getDistanceInMeters(coord1: GeoCoord, coord2: GeoCoord): number` calculates a distance in meters.
- `getDistanceInKilometers(coord1: GeoCoord, coord2: GeoCoord): number` calculates a distance in kilometers.
- `getDistanceInMiles(coord1: GeoCoord, coord2: GeoCoord): number` calculates a distance in miles.
- `GeoCoord` is an interface with `latitude: number` and `longitude: number`.
## Using SystemJS
To load `ng2-haversine` using [SystemJS](https://github.com/systemjs/systemjs) is as simple as this. Open your `systemjs.config.js` file and set `map` and `packages` properties this way:
To load `ng2-haversine` using [SystemJS](https://github.com/systemjs/systemjs) is as simple as this. Open your `systemjs.config.js` file and set `paths`, `map` and `packages` properties this way:

@@ -81,2 +92,5 @@ ```javascript

System.config({
paths: {
"npm:": "node_modules/"
},
map: {

@@ -83,0 +97,0 @@ ...

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