@socotra/ec-react-utils 2.18.2-next.0 → 2.19.0-next.1
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/dist/index.d.ts +16 -0
- package/dist/index.es.js +777 -762
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -207,6 +207,22 @@ declare interface ExtractElementDataModelFromTypeInterface {
|
|
|
207
207
|
}): string | null;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* The function `extractElementByType` takes a `QuoteResponse`, `SegmentResponse`, or `ElementResponse` object and an element type string,
|
|
212
|
+
* and searches for elements matching the specified type from the response or its nested elements.
|
|
213
|
+
* If a single element is found, it returns that element.
|
|
214
|
+
* If multiple elements are found, it returns an array of these elements.
|
|
215
|
+
* If no elements are found, it returns null.
|
|
216
|
+
*
|
|
217
|
+
* @param {QuoteResponse | SegmentResponse | ElementResponse} response - The response object (QuoteResponse, SegmentResponse, or ElementResponse)
|
|
218
|
+
* to search within for the specified element type.
|
|
219
|
+
* @param {string} elementType - The `elementType` parameter is a string that represents the
|
|
220
|
+
* type of the element you want to extract from the `response` object.
|
|
221
|
+
* @returns {T | T[] | null} The function returns a single element of type T if one is found,
|
|
222
|
+
* an array of T elements (T[]) if multiple are found, or null if no such elements exist.
|
|
223
|
+
*/
|
|
224
|
+
export declare const extractElementsByType: <T extends ElementResponse>(response: QuoteResponse | SegmentResponse | ElementResponse, elementType: string) => T[] | null;
|
|
225
|
+
|
|
210
226
|
export declare const extractElementsFromQuote: (elements: Array<ElementResponse>, elementType: string) => ({
|
|
211
227
|
locator: string;
|
|
212
228
|
type: string;
|