@@ -55,12 +55,12 @@ return /******/ (function(modules) { // webpackBootstrap
5555/***/ 0 :
5656/***/ function ( module , exports , __webpack_require__ ) {
5757
58- module . exports = __webpack_require__ ( 16 ) ;
58+ module . exports = __webpack_require__ ( 13 ) ;
5959
6060
6161/***/ } ,
6262
63- /***/ 16 :
63+ /***/ 13 :
6464/***/ function ( module , exports , __webpack_require__ ) {
6565
6666 'use strict' ;
@@ -69,7 +69,7 @@ return /******/ (function(modules) { // webpackBootstrap
6969 value : true
7070 } ) ;
7171
72- var _nominatim = __webpack_require__ ( 17 ) ;
72+ var _nominatim = __webpack_require__ ( 14 ) ;
7373
7474 var _nominatim2 = _interopRequireDefault ( _nominatim ) ;
7575
@@ -89,7 +89,7 @@ return /******/ (function(modules) { // webpackBootstrap
8989
9090/***/ } ,
9191
92- /***/ 17 :
92+ /***/ 14 :
9393/***/ function ( module , exports ) {
9494
9595 'use strict' ;
@@ -98,13 +98,23 @@ return /******/ (function(modules) { // webpackBootstrap
9898 value : true
9999 } ) ;
100100
101+ var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
102+
103+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
104+
101105 /**
102106 * @ngdoc service
103107 * @name osm.nominatim.osmNominatim
104108 * @description handle nominatim query
105109 */
106- function osmNominatim ( $http , options ) {
107- this . url = options . url ;
110+
111+ var osmNominatim = function ( ) {
112+ function osmNominatim ( $http , options ) {
113+ _classCallCheck ( this , osmNominatim ) ;
114+
115+ this . url = options . url ;
116+ this . $http = $http ;
117+ }
108118
109119 /**
110120 * @ngdoc method
@@ -114,84 +124,97 @@ return /******/ (function(modules) { // webpackBootstrap
114124 * @methodOf osm.nominatim.osmNominatim
115125 * @return {Promise } $http.get
116126 */
117- this . search = function search ( query ) {
118- //https://nominatim.openstreetmap.org/search
119- //?X-Requested-With=overpass-turbo&format=json&q=vern-sur-seiche
120- //params['accept-language'] = 'fr';
121- var params ;
122- if ( typeof query === 'string' || ! query ) {
123- params = {
124- format : 'json' ,
125- q : query
127+
128+
129+ _createClass ( osmNominatim , [ {
130+ key : 'search' ,
131+ value : function search ( query ) {
132+ //https://nominatim.openstreetmap.org/search
133+ //?X-Requested-With=overpass-turbo&format=json&q=vern-sur-seiche
134+ //params['accept-language'] = 'fr';
135+ var params ;
136+ if ( typeof query === 'string' || ! query ) {
137+ params = {
138+ format : 'json' ,
139+ q : query
140+ } ;
141+ } else {
142+ params = angular . copy ( query ) ;
143+ params . format = 'json' ;
144+ }
145+ var config = {
146+ params : params
126147 } ;
127- } else {
128- params = angular . copy ( query ) ;
129- params . format = 'json' ;
148+ var url = this . url + '/search' ;
149+ return this . $http . get ( url , config ) ;
130150 }
131- var config = {
132- params : params
133- } ;
134- var url = this . url + '/search' ;
135- return $http . get ( url , config ) ;
136- } ;
137151
138- /**
139- * @ngdoc method
140- * @name reverse
141- * @param {Object/String } query
142- * http://wiki.openstreetmap.org/wiki/Nominatim
143- * @methodOf osm.nominatim.osmNominatim
144- * @return {Promise } $http.get
145- */
146- this . reverse = function reverse ( query ) {
147- //https://nominatim.openstreetmap.org/reverse
148- //?X-Requested-With=overpass-turbo&format=json&q=vern-sur-seiche
149- //params['accept-language'] = 'fr';
150- var params ;
151- if ( typeof query === 'string' ) {
152- params = {
153- format : 'json' ,
154- q : query
152+ /**
153+ * @ngdoc method
154+ * @name reverse
155+ * @param {Object/String } query
156+ * http://wiki.openstreetmap.org/wiki/Nominatim
157+ * @methodOf osm.nominatim.osmNominatim
158+ * @return {Promise } $http.get
159+ */
160+
161+ } , {
162+ key : 'reverse' ,
163+ value : function reverse ( query ) {
164+ //https://nominatim.openstreetmap.org/reverse
165+ //?X-Requested-With=overpass-turbo&format=json&q=vern-sur-seiche
166+ //params['accept-language'] = 'fr';
167+ var params ;
168+ if ( typeof query === 'string' ) {
169+ params = {
170+ format : 'json' ,
171+ q : query
172+ } ;
173+ } else {
174+ params = angular . copy ( query ) ;
175+ params . format = 'json' ;
176+ }
177+ var config = {
178+ params : params
155179 } ;
156- } else {
157- params = angular . copy ( query ) ;
158- params . format = 'json' ;
180+ var url = this . url + '/reverse' ;
181+ return this . $http . get ( url , config ) ;
159182 }
160- var config = {
161- params : params
162- } ;
163- var url = this . url + '/reverse' ;
164- return $http . get ( url , config ) ;
165- } ;
166183
167- /**
168- * @ngdoc method
169- * @name lookup
170- * @description
171- * http://nominatim.openstreetmap.org/lookup?osm_ids=R146656,W104393803,N240109189
172- * @param {Object/String } query
173- * http://wiki.openstreetmap.org/wiki/Nominatim
174- * @methodOf osm.nominatim.osmNominatim
175- * @return {Promise } $http.get
176- */
177- this . lookup = function lookup ( query ) {
178- var params ;
179- if ( typeof query === 'string' ) {
180- params = {
181- format : 'json' ,
182- q : query
184+ /**
185+ * @ngdoc method
186+ * @name lookup
187+ * @description
188+ * http://nominatim.openstreetmap.org/lookup?osm_ids=R146656,W104393803,N240109189
189+ * @param {Object/String } query
190+ * http://wiki.openstreetmap.org/wiki/Nominatim
191+ * @methodOf osm.nominatim.osmNominatim
192+ * @return {Promise } $http.get
193+ */
194+
195+ } , {
196+ key : 'lookup' ,
197+ value : function lookup ( query ) {
198+ var params ;
199+ if ( typeof query === 'string' ) {
200+ params = {
201+ format : 'json' ,
202+ q : query
203+ } ;
204+ } else {
205+ params = angular . copy ( query ) ;
206+ params . format = 'json' ;
207+ }
208+ var config = {
209+ params : params
183210 } ;
184- } else {
185- params = angular . copy ( query ) ;
186- params . format = 'json' ;
211+ var url = this . url + '/lookup' ;
212+ return this . $http . get ( url , config ) ;
187213 }
188- var config = {
189- params : params
190- } ;
191- var url = this . url + '/lookup' ;
192- return $http . get ( url , config ) ;
193- } ;
194- }
214+ } ] ) ;
215+
216+ return osmNominatim ;
217+ } ( ) ;
195218
196219 exports . default = osmNominatim ;
197220
0 commit comments