File tree Expand file tree Collapse file tree 3 files changed +12
-27
lines changed
Expand file tree Collapse file tree 3 files changed +12
-27
lines changed Original file line number Diff line number Diff line change 22 "name" : " simple-reverse-geocoder" ,
33 "version" : " 1.1.0" ,
44 "description" : " Get address from a point" ,
5- "main" : " lib " ,
5+ "main" : " src " ,
66 "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" ,
107 "lint" : " eslint src" ,
11- "clean" : " rimraf lib" ,
12- "pretest" : " npm run build -s" ,
13- "test" : " mocha --compilers js:babel-core/register"
8+ "test" : " mocha"
149 },
1510 "engines" : {
1611 "node" : " >=0.12"
3429 "node-geocoder" : " ^3.8.0"
3530 },
3631 "devDependencies" : {
37- "babel-cli" : " ^6.6.0" ,
38- "babel-core" : " ^6.6.0" ,
39- "babel-preset-es2015" : " ^6.6.0" ,
4032 "chai" : " ^3.5.0" ,
4133 "eslint" : " 2.12.0" ,
4234 "mocha" : " ^2.4.5" ,
5042 "mocha" : true
5143 },
5244 "extends" : " eslint:recommended" ,
53- "parserOptions" : {
54- "sourceType" : " module"
55- },
5645 "rules" : {
5746 "indent" : [
5847 2 ,
7261 ]
7362 }
7463 },
75- "babel" : {
76- "presets" : [
77- " es2015"
78- ]
79- },
8064 "tonicExampleFilename" : " example.js"
8165}
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- import nodeGeocoder from 'node-geocoder' ;
4- import Promise from 'bluebird' ;
3+ const nodeGeocoder = require ( 'node-geocoder' ) ;
4+ const Promise = require ( 'bluebird' ) ;
55
66let client ;
77
8- const setCache = ( instance ) => {
8+ const setCache = instance => {
99 client = instance ;
1010 Promise . promisifyAll ( Object . getPrototypeOf ( client ) ) ;
1111} ;
@@ -22,10 +22,11 @@ const getReverse = (lat, lng) => {
2222 } ) ;
2323} ;
2424
25- const getCoordinates = ( loc ) => {
25+ const getCoordinates = loc => {
2626 return new Promise ( ( resolve , reject ) => {
2727 try {
28- const [ lng , lat ] = loc . coordinates ;
28+ const lng = loc . coordinates [ 0 ] ;
29+ const lat = loc . coordinates [ 1 ] ;
2930 resolve ( { lng : lng , lat : lat } ) ;
3031 } catch ( err ) {
3132 reject ( err ) ;
@@ -39,7 +40,7 @@ const getFromCache = (lat, lng) => {
3940 } ) ;
4041} ;
4142
42- const getAddress = ( loc ) => {
43+ const getAddress = loc => {
4344 return new Promise ( ( resolve , reject ) => {
4445 getCoordinates ( loc ) . then ( ( { lng, lat} ) => {
4546 if ( client ) {
Original file line number Diff line number Diff line change 11'use strict' ;
22
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' ) ;
66
77describe ( 'simple-reverse-geocoder' , ( ) => {
88 before ( ( ) => {
You can’t perform that action at this time.
0 commit comments