@pretto/places 0.10.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,3 @@
1
- interface AddressSearchResult {
2
- label: string;
3
- value: {
4
- city: string;
5
- country: string;
6
- street: string;
7
- zipcode: string;
8
- };
9
- }
10
1
  export interface AddressApiResult {
11
2
  properties: {
12
3
  label: string;
@@ -21,7 +12,6 @@ interface Options {
21
12
  country: string;
22
13
  limit: number;
23
14
  }
24
- declare type AddressSearch = (search: string, options?: Options) => Promise<AddressSearchResult[] | string>;
25
- export declare const get: AddressSearch;
15
+ export declare const get: (search: string, options?: Options | undefined, debounceValue?: 300 | undefined) => number;
26
16
  export {};
27
17
  //# sourceMappingURL=addressSearch.d.ts.map
@@ -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,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"}
1
+ {"version":3,"file":"addressSearch.d.ts","sourceRoot":"","sources":["../src/addressSearch.ts"],"names":[],"mappings":"AAUA,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;AAuCD,eAAO,MAAM,GAAG,WAAY,MAAM,2EAQjC,CAAA"}
package/dist/index.js CHANGED
@@ -100,7 +100,7 @@ const responseFormat = (places, country, search, departmentOnly) => {
100
100
  });
101
101
  return flat__default["default"](allPlaces);
102
102
  };
103
- const get$2 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
103
+ const getData$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
104
104
  const { country = 'fr', limit = 5, departmentOnly = false } = options || {};
105
105
  const isNumber = !isNaN(parseInt(search, 10));
106
106
  if (!search || (isNumber && search.length < 2))
@@ -133,13 +133,22 @@ const get$2 = (search, options) => __awaiter(void 0, void 0, void 0, function* (
133
133
  return 'An error occurred.';
134
134
  }
135
135
  });
136
+ let getDelayedData$1;
137
+ const get$2 = (search, options, debounceValue) => {
138
+ clearTimeout(getDelayedData$1);
139
+ getDelayedData$1 = setTimeout(() => {
140
+ getData$1(search, options);
141
+ }, debounceValue);
142
+ return getDelayedData$1;
143
+ };
136
144
 
137
145
  var municipalitySearch = /*#__PURE__*/Object.freeze({
138
146
  __proto__: null,
147
+ getData: getData$1,
139
148
  get: get$2
140
149
  });
141
150
 
142
- const get$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
151
+ const getData = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
143
152
  if (!search)
144
153
  return [];
145
154
  try {
@@ -172,6 +181,14 @@ const get$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* (
172
181
  return 'An error occurred.';
173
182
  }
174
183
  });
184
+ let getDelayedData;
185
+ const get$1 = (search, options, debounceValue) => {
186
+ clearTimeout(getDelayedData);
187
+ getDelayedData = setTimeout(() => {
188
+ getData(search, options);
189
+ }, debounceValue);
190
+ return getDelayedData;
191
+ };
175
192
 
176
193
  var addressSearch = /*#__PURE__*/Object.freeze({
177
194
  __proto__: null,
package/dist/module.js CHANGED
@@ -90,7 +90,7 @@ const responseFormat = (places, country, search, departmentOnly) => {
90
90
  });
91
91
  return flat(allPlaces);
92
92
  };
93
- const get$2 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
93
+ const getData$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
94
94
  const { country = 'fr', limit = 5, departmentOnly = false } = options || {};
95
95
  const isNumber = !isNaN(parseInt(search, 10));
96
96
  if (!search || (isNumber && search.length < 2))
@@ -123,13 +123,22 @@ const get$2 = (search, options) => __awaiter(void 0, void 0, void 0, function* (
123
123
  return 'An error occurred.';
124
124
  }
125
125
  });
126
+ let getDelayedData$1;
127
+ const get$2 = (search, options, debounceValue) => {
128
+ clearTimeout(getDelayedData$1);
129
+ getDelayedData$1 = setTimeout(() => {
130
+ getData$1(search, options);
131
+ }, debounceValue);
132
+ return getDelayedData$1;
133
+ };
126
134
 
127
135
  var municipalitySearch = /*#__PURE__*/Object.freeze({
128
136
  __proto__: null,
137
+ getData: getData$1,
129
138
  get: get$2
130
139
  });
131
140
 
132
- const get$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
141
+ const getData = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
133
142
  if (!search)
134
143
  return [];
135
144
  try {
@@ -162,6 +171,14 @@ const get$1 = (search, options) => __awaiter(void 0, void 0, void 0, function* (
162
171
  return 'An error occurred.';
163
172
  }
164
173
  });
174
+ let getDelayedData;
175
+ const get$1 = (search, options, debounceValue) => {
176
+ clearTimeout(getDelayedData);
177
+ getDelayedData = setTimeout(() => {
178
+ getData(search, options);
179
+ }, debounceValue);
180
+ return getDelayedData;
181
+ };
165
182
 
166
183
  var addressSearch = /*#__PURE__*/Object.freeze({
167
184
  __proto__: null,
@@ -20,6 +20,7 @@ interface Options {
20
20
  departmentOnly?: boolean;
21
21
  }
22
22
  declare type MunicipalitySearch = (search: string, options?: Options) => Promise<MunicipalitySearchResult[] | string>;
23
- export declare const get: MunicipalitySearch;
23
+ export declare const getData: MunicipalitySearch;
24
+ export declare const get: (search: string, options?: Options | undefined, debounceValue?: 300 | undefined) => number;
24
25
  export {};
25
26
  //# sourceMappingURL=municipalitySearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"municipalitySearch.d.ts","sourceRoot":"","sources":["../src/municipalitySearch.ts"],"names":[],"mappings":"AAKA,UAAU,wBAAwB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAED,UAAU,OAAO;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,aAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,wBAAwB,EAAE,GAAG,MAAM,CAAC,CAAA;AAmD7G,eAAO,MAAM,GAAG,EAAE,kBAoCjB,CAAA"}
1
+ {"version":3,"file":"municipalitySearch.d.ts","sourceRoot":"","sources":["../src/municipalitySearch.ts"],"names":[],"mappings":"AAKA,UAAU,wBAAwB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAED,UAAU,OAAO;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,aAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,wBAAwB,EAAE,GAAG,MAAM,CAAC,CAAA;AAmD7G,eAAO,MAAM,OAAO,EAAE,kBAoCrB,CAAA;AAID,eAAO,MAAM,GAAG,WAAY,MAAM,2EAQjC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretto/places",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",