@pretto/places 0.13.0 → 0.14.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.
Files changed (2) hide show
  1. package/README.md +28 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -21,7 +21,7 @@ import { municipalitySearch } from '@pretto/places'
21
21
  const result = await municipalitySearch.get("paris", { limit: 21 })
22
22
 
23
23
  // expected result : Paris (75001), Paris (75002), Paris (75003), ..., Paris (75020)
24
- // result object format :
24
+ // result object format :
25
25
  [
26
26
  {
27
27
  "label": "Paris (75001)",
@@ -51,7 +51,7 @@ import { municipalitySearch } from '@pretto/places'
51
51
  const result = await municipalitySearch.get("paris", { departmentOnly: true, limit: 21 })
52
52
 
53
53
  // expected result : Paris (75), Parisot(81), Parisot (82), Cormeilles-en-Parisis (95), ...
54
- // result object format :
54
+ // result object format :
55
55
  [
56
56
  {
57
57
  "label": "Paris (75)",
@@ -81,7 +81,7 @@ import { addressSearch } from '@pretto/places'
81
81
  const result = await addressSearch.get("55 rue de paradis", { limit: 10 })
82
82
 
83
83
  // expected result : 55 Rue de Paradis 75010 Paris (75010), 55 Rue de Paradis 51160 Hautvillers (51160)...
84
- // result object format :
84
+ // result object format :
85
85
  [
86
86
  {
87
87
  "label": "55 Rue de Paradis 75010 Paris (75010)",
@@ -111,26 +111,34 @@ For country
111
111
  import { countrySearch } from '@pretto/places'
112
112
 
113
113
  const countriesApi = countrySearch.init(ALGOLIA_COUNTRIES_APP_ID, ALGOLIA_COUNTRIES_API_KEY)
114
- const results = await countriesApi.get("al", { limit: 10 })
115
-
116
- // expected result : Allemagne (99109), Albanie (99125), Algerie (99352)
117
- // result object format :
118
- [
119
- {
120
- "label": "Allemagne (99109)",
121
- "value": "de"
122
- },
123
- {
124
- "label": "Albanie (99125)",
125
- "value": "al"
126
- },
127
- {
128
- "label": "Algerie (99352)",
129
- "value": "dz"
130
- }
114
+ const results = await countriesApi.get('al', { limit: 10 })[
115
+ // expected result : Allemagne (99109), Albanie (99125), Algerie (99352)
116
+ // result object format :
117
+ ({
118
+ label: 'Allemagne (99109)',
119
+ value: 'de',
120
+ },
121
+ {
122
+ label: 'Albanie (99125)',
123
+ value: 'al',
124
+ },
125
+ {
126
+ label: 'Algerie (99352)',
127
+ value: 'dz',
128
+ })
131
129
  ]
132
130
  ```
133
131
 
132
+ ### Debounce
133
+
134
+ `addressSearch` and `municipalitySearch` have defaut debounce value fixed to **300ms**\
135
+ You can override this value by passing `debounceValue` as last argument
136
+
137
+ ```jsx
138
+ const debounceValue = 1000 // --- 1000 = 1s
139
+ const results = await countriesApi.get('al', { limit: 10 }, debounceValue)
140
+ ```
141
+
134
142
  ### How to publish a new version?
135
143
 
136
144
  When a branch is merged into master, it will automatically deploy a new version to npm.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretto/places",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",