Skip to content

Commit

Permalink
feat: remove type:module from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbieh committed Dec 11, 2019
1 parent a292178 commit 256d3b3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ geolib.getCoordinateKeys({ lat: 1, lon: 1 });

Returns an object with a `latitude` and a `longitude` property. Their values are the property names for latitude and longitude that are used in the passed point. Should probably only be used internally.

### getCoordinateKey(point, keysToLookup)`
### `getCoordinateKey(point, keysToLookup)`

Is used by `getCoordinateKeys` under the hood and returns the property name out of a list of possible names.

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "lib/index.js",
"module": "es/index.js",
"typings": "es/index.d.ts",
"type": "module",
"files": [
"lib",
"es"
Expand Down
17 changes: 13 additions & 4 deletions src/getCoordinateKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,29 @@ import {
import { longitudeKeys, latitudeKeys, altitudeKeys } from './constants';
import getCoordinateKey from './getCoordinateKey';

const getCoordinateKeys = (point: GeolibInputCoordinates) => {
// TODO: add second parameter that can be passed as keysToLookup to getCoordinateKey
// e.g. { latitude: ['lat', 'latitude'], longitude: ['lon', 'longitude']}
const getCoordinateKeys = (
point: GeolibInputCoordinates,
keysToLookup = {
longitude: longitudeKeys,
latitude: latitudeKeys,
altitude: altitudeKeys,
}
) => {
const longitude: LongitudeKeys | undefined = getCoordinateKey(
point,
longitudeKeys
keysToLookup.longitude
);

const latitude: LatitudeKeys | undefined = getCoordinateKey(
point,
latitudeKeys
keysToLookup.latitude
);

const altitude: AltitudeKeys | undefined = getCoordinateKey(
point,
altitudeKeys
keysToLookup.altitude
);

return {
Expand Down

0 comments on commit 256d3b3

Please sign in to comment.