@pittica/google-business-intelligence-helpers 1.16.0 → 1.17.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.
package/dist/index.js CHANGED
@@ -59,7 +59,8 @@ const {
59
59
  createFilename,
60
60
  mergeFilename,
61
61
  mergeFiledata,
62
- isFiledataMatch
62
+ isFiledataMatch,
63
+ safeFilenamesProcess
63
64
  } = require("./naming/file");
64
65
  const {
65
66
  splitName,
@@ -116,6 +117,7 @@ exports.createFilename = createFilename;
116
117
  exports.mergeFilename = mergeFilename;
117
118
  exports.mergeFiledata = mergeFiledata;
118
119
  exports.isFiledataMatch = isFiledataMatch;
120
+ exports.safeFilenamesProcess = safeFilenamesProcess;
119
121
  exports.splitName = splitName;
120
122
  exports.splitIdByKeys = splitIdByKeys;
121
123
  exports.scripts = {
@@ -96,4 +96,14 @@ exports.mergeFiledata = ({
96
96
  * @param {object} second Second object compare.
97
97
  * @returns {boolean} True if the filenames match, false otherwise.
98
98
  */
99
- exports.isFiledataMatch = (first, second) => exports.mergeFilename(first) === exports.mergeFilename(second);
99
+ exports.isFiledataMatch = (first, second) => exports.mergeFilename(first) === exports.mergeFilename(second);
100
+
101
+ /**
102
+ * Processes filenames safely based on the provided configuration.
103
+ *
104
+ * @param {Array} files Array of file objects.
105
+ * @param {Array} configuration Array of allowed filenames.
106
+ * @returns {Array} Array of processed filenames.
107
+ * @since 1.17.0
108
+ */
109
+ exports.safeFilenamesProcess = (files, configuration = []) => files.map(file => splitName(file)).filter(file => configuration.includes(file.name)).map(file => mergeFiledata(file));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pittica/google-business-intelligence-helpers",
3
3
  "private": false,
4
- "version": "1.16.0",
4
+ "version": "1.17.0",
5
5
  "description": "Helpers for business intelligence for Google Cloud.",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {