@pretto/places 0.7.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/addressSearch.d.ts +3 -2
- package/dist/addressSearch.d.ts.map +1 -1
- package/dist/index.js +13 -10
- package/dist/module.js +13 -10
- package/package.json +1 -1
package/README.md
CHANGED
@@ -135,7 +135,7 @@ const results = await countriesApi.get("al", { limit: 10 })
|
|
135
135
|
|
136
136
|
When a branch is merged into master, it will automatically deploy a new version to npm.
|
137
137
|
|
138
|
-
### How
|
138
|
+
### How it works?
|
139
139
|
|
140
140
|
This library is based on the API of data.gouv.
|
141
141
|
These data are quite precise and are regularly updated:
|
package/dist/addressSearch.d.ts
CHANGED
@@ -10,10 +10,11 @@ interface AddressSearchResult {
|
|
10
10
|
export interface AddressApiResult {
|
11
11
|
properties: {
|
12
12
|
label: string;
|
13
|
+
name: string;
|
13
14
|
postcode: string;
|
14
15
|
city: string;
|
15
|
-
housenumber
|
16
|
-
street
|
16
|
+
housenumber?: string;
|
17
|
+
street?: string;
|
17
18
|
};
|
18
19
|
}
|
19
20
|
interface Options {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addressSearch.d.ts","sourceRoot":"","sources":["../src/addressSearch.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;
|
1
|
+
{"version":3,"file":"addressSearch.d.ts","sourceRoot":"","sources":["../src/addressSearch.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,UAAU,OAAO;IACf,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,aAAK,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,EAAE,GAAG,MAAM,CAAC,CAAA;AAEnG,eAAO,MAAM,GAAG,EAAE,aA+BjB,CAAA"}
|
package/dist/index.js
CHANGED
@@ -149,17 +149,20 @@ const get$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* (
|
|
149
149
|
if (!response.ok)
|
150
150
|
return Promise.reject(response);
|
151
151
|
const result = yield response.json();
|
152
|
-
return result.features.
|
153
|
-
return
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
152
|
+
return result.features.reduce((acc, { properties }) => {
|
153
|
+
return [
|
154
|
+
...acc,
|
155
|
+
{
|
156
|
+
label: `${properties.name} (${properties.postcode})`,
|
157
|
+
value: {
|
158
|
+
city: properties.city,
|
159
|
+
country,
|
160
|
+
street: `${properties.name}`,
|
161
|
+
zipcode: properties.postcode,
|
162
|
+
},
|
160
163
|
},
|
161
|
-
|
162
|
-
});
|
164
|
+
];
|
165
|
+
}, []);
|
163
166
|
}
|
164
167
|
catch (error) {
|
165
168
|
if (typeof error === 'string')
|
package/dist/module.js
CHANGED
@@ -139,17 +139,20 @@ const get$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* (
|
|
139
139
|
if (!response.ok)
|
140
140
|
return Promise.reject(response);
|
141
141
|
const result = yield response.json();
|
142
|
-
return result.features.
|
143
|
-
return
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
142
|
+
return result.features.reduce((acc, { properties }) => {
|
143
|
+
return [
|
144
|
+
...acc,
|
145
|
+
{
|
146
|
+
label: `${properties.name} (${properties.postcode})`,
|
147
|
+
value: {
|
148
|
+
city: properties.city,
|
149
|
+
country,
|
150
|
+
street: `${properties.name}`,
|
151
|
+
zipcode: properties.postcode,
|
152
|
+
},
|
150
153
|
},
|
151
|
-
|
152
|
-
});
|
154
|
+
];
|
155
|
+
}, []);
|
153
156
|
}
|
154
157
|
catch (error) {
|
155
158
|
if (typeof error === 'string')
|