@adobe/spacecat-shared-utils 1.14.0 → 1.14.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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/helpers.js +9 -4
- package/src/index.d.ts +12 -0
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.14.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.14.0...@adobe/spacecat-shared-utils-v1.14.1) (2024-03-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* jsdoc for generateCSVFile and release ([#187](https://github.com/adobe/spacecat-shared/issues/187)) ([e8e30ed](https://github.com/adobe/spacecat-shared/commit/e8e30eddb0609370898e022d1f986cbc5db83e36))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-utils-v1.14.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.13.2...@adobe/spacecat-shared-utils-v1.14.0) (2024-03-18)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/helpers.js
CHANGED
|
@@ -58,10 +58,15 @@ export function isAuditsDisabled(site, organization, auditType) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
* Generates a CSV file from the provided JSON data.
|
|
62
|
+
*
|
|
63
|
+
* Each key-value pair in the JSON objects
|
|
64
|
+
* corresponds to a column and its value in the CSV. The output is a UTF-8
|
|
65
|
+
* encoded Buffer that represents the CSV file content.
|
|
66
|
+
*
|
|
67
|
+
* @param {Object[]} data - An array of JSON objects to be converted into CSV format.
|
|
68
|
+
* @returns {Buffer} A Buffer containing the CSV formatted data, encoded in UTF-8.
|
|
69
|
+
*/
|
|
65
70
|
export function generateCSVFile(data) {
|
|
66
71
|
const json2csvParser = new Parser();
|
|
67
72
|
return Buffer.from(json2csvParser.parse(data), 'utf-8');
|
package/src/index.d.ts
CHANGED
|
@@ -108,3 +108,15 @@ declare function composeAuditURL(url: string): Promise<string>;
|
|
|
108
108
|
* @returns {boolean} - True if the audit(s) are disabled, otherwise false.
|
|
109
109
|
*/
|
|
110
110
|
declare function isAuditsDisabled(site: object, organization: object, auditType?: string): boolean
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Generates a CSV file from the provided JSON data.
|
|
114
|
+
*
|
|
115
|
+
* Each key-value pair in the JSON objects
|
|
116
|
+
* corresponds to a column and its value in the CSV. The output is a UTF-8
|
|
117
|
+
* encoded Buffer that represents the CSV file content.
|
|
118
|
+
*
|
|
119
|
+
* @param {Object[]} data - An array of JSON objects to be converted into CSV format.
|
|
120
|
+
* @returns {Buffer} A Buffer containing the CSV formatted data, encoded in UTF-8.
|
|
121
|
+
*/
|
|
122
|
+
declare function generateCSVFile(data: object[]): Buffer;
|