File tree 3 files changed +12
-27
lines changed
3 files changed +12
-27
lines changed Original file line number Diff line number Diff line change 2
2
"name" : " simple-reverse-geocoder" ,
3
3
"version" : " 1.1.0" ,
4
4
"description" : " Get address from a point" ,
5
- "main" : " lib " ,
5
+ "main" : " src " ,
6
6
"scripts" : {
7
- "prepublish" : " npm run build -s" ,
8
- "prebuild" : " npm run lint -s && npm run clean -s" ,
9
- "build" : " babel src --out-dir lib --source-maps" ,
10
7
"lint" : " eslint src" ,
11
- "clean" : " rimraf lib" ,
12
- "pretest" : " npm run build -s" ,
13
- "test" : " mocha --compilers js:babel-core/register"
8
+ "test" : " mocha"
14
9
},
15
10
"engines" : {
16
11
"node" : " >=0.12"
34
29
"node-geocoder" : " ^3.8.0"
35
30
},
36
31
"devDependencies" : {
37
- "babel-cli" : " ^6.6.0" ,
38
- "babel-core" : " ^6.6.0" ,
39
- "babel-preset-es2015" : " ^6.6.0" ,
40
32
"chai" : " ^3.5.0" ,
41
33
"eslint" : " 2.12.0" ,
42
34
"mocha" : " ^2.4.5" ,
50
42
"mocha" : true
51
43
},
52
44
"extends" : " eslint:recommended" ,
53
- "parserOptions" : {
54
- "sourceType" : " module"
55
- },
56
45
"rules" : {
57
46
"indent" : [
58
47
2 ,
72
61
]
73
62
}
74
63
},
75
- "babel" : {
76
- "presets" : [
77
- " es2015"
78
- ]
79
- },
80
64
"tonicExampleFilename" : " example.js"
81
65
}
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- import nodeGeocoder from 'node-geocoder' ;
4
- import Promise from 'bluebird' ;
3
+ const nodeGeocoder = require ( 'node-geocoder' ) ;
4
+ const Promise = require ( 'bluebird' ) ;
5
5
6
6
let client ;
7
7
8
- const setCache = ( instance ) => {
8
+ const setCache = instance => {
9
9
client = instance ;
10
10
Promise . promisifyAll ( Object . getPrototypeOf ( client ) ) ;
11
11
} ;
@@ -22,10 +22,11 @@ const getReverse = (lat, lng) => {
22
22
} ) ;
23
23
} ;
24
24
25
- const getCoordinates = ( loc ) => {
25
+ const getCoordinates = loc => {
26
26
return new Promise ( ( resolve , reject ) => {
27
27
try {
28
- const [ lng , lat ] = loc . coordinates ;
28
+ const lng = loc . coordinates [ 0 ] ;
29
+ const lat = loc . coordinates [ 1 ] ;
29
30
resolve ( { lng : lng , lat : lat } ) ;
30
31
} catch ( err ) {
31
32
reject ( err ) ;
@@ -39,7 +40,7 @@ const getFromCache = (lat, lng) => {
39
40
} ) ;
40
41
} ;
41
42
42
- const getAddress = ( loc ) => {
43
+ const getAddress = loc => {
43
44
return new Promise ( ( resolve , reject ) => {
44
45
getCoordinates ( loc ) . then ( ( { lng, lat} ) => {
45
46
if ( client ) {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- import { expect } from 'chai' ;
4
- import redis from 'redis' ;
5
- import rg from '../lib' ;
3
+ const expect = require ( 'chai' ) . expect ;
4
+ const redis = require ( 'redis' ) ;
5
+ const rg = require ( '../src' ) ;
6
6
7
7
describe ( 'simple-reverse-geocoder' , ( ) => {
8
8
before ( ( ) => {
You can’t perform that action at this time.
0 commit comments