Global

Methods

# composeSoapXml(soapBody) → {string}

Composes a SOAP XML document by wrapping the provided SOAP body with the necessary SOAP envelope and header.
Parameters:
Name Type Description
soapBody string The SOAP body content to be wrapped.

View Source utils/soap.js, line 14

The complete SOAP XML document.
string
Example
const soapBodyContent = '<example:Request xmlns:example="http://example.com">...</example:Request>';
const soapXml = composeSoapXml(soapBodyContent);
console.log('Composed SOAP XML:', soapXml);

# async fetchAndParseCSV(url) → {Promise.<Object>}

Fetches and parses CSV data from the specified URL using the PapaParse library.
Parameters:
Name Type Description
url string The URL to fetch CSV data from.

View Source utils/parse.js, line 60

A promise that resolves to an object representing the parsed CSV data.
Promise.<Object>
Example
const url = 'https://example.com/data.csv';
const csvData = await fetchAndParseCSV(url);
console.log('Parsed CSV Data:', csvData);

# fetchAndParseHTML(url, targetClass) → {Promise.<Array.<string>>}

Fetches HTML content from the specified URL, parses it using Cheerio, and extracts links with the target class.
Parameters:
Name Type Description
url string The URL to fetch HTML content from.
targetClass string The class of the elements to select and extract links.

View Source utils/parse.js, line 19

A promise that resolves to an array of links extracted from the HTML content.
Promise.<Array.<string>>
Example
const url = 'https://example.com';
const targetClass = 'link-class';
const links = await fetchAndParseHTML(url, targetClass);
console.log('Extracted Links:', links);

# getDomainFromUrl(url) → {string}

Extracts the domain from the provided URL.
Parameters:
Name Type Description
url string The URL from which to extract the domain.

View Source utils/url.js, line 14

The domain extracted from the URL.
string
Example
const exampleUrl = 'https://www.example.com/path/to/resource';
const domain = getDomainFromUrl(exampleUrl);
console.log('Extracted Domain:', domain); // Output: 'www.example.com'

# objectToQueryString(obj) → {string}

Convert an object into a URL query string.
Parameters:
Name Type Description
obj Object The object to convert.

View Source utils/format.js, line 11

A URL query string representation of the object.
string
Example
const params = { provinceCode: 11, regionCode: 08 };
const queryString = objectToQueryString(params);
// Result: 'provinceCode=11&regionCode=08'

# parseXml(xmlString) → {Promise.<Object>}

Parses an XML string using the xml2js library, converting it into a JavaScript object.
Parameters:
Name Type Description
xmlString string The XML string to be parsed.

View Source utils/xmlParser.js, line 16

A promise that resolves with the JavaScript object representation of the parsed XML.
Promise.<Object>
Example
const exampleXml = '<root><element>Value</element></root>';
const parsedObject = await parseXml(exampleXml);
console.log('Parsed XML Object:', parsedObject);