@rokkit/data 1.1.18 → 1.2.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.
@@ -19,13 +19,38 @@
19
19
  * @returns {RegExp} - The regular expression pattern to identify search filter elements.
20
20
  */
21
21
  export function getRegex(): RegExp;
22
+ /**
23
+ * A parsed filter condition.
24
+ *
25
+ * @typedef {Object} FilterObject
26
+ * @property {string} [column] - Column to filter (undefined = search all columns)
27
+ * @property {string} operator - Comparison operator
28
+ * @property {string|number|RegExp} value - Filter value
29
+ */
22
30
  /**
23
31
  * Parses a search string and extracts filters based on a predefined regular expression pattern.
24
32
  * Each filter captures column, operator, and value components. Any remaining text that
25
33
  * does not fit the pattern is considered a general search term.
26
34
  *
27
35
  * @param {string} string - The search string to parse for filters.
28
- * @returns {Object[]} - An array of filter objects each containing the column, operator, and value,
36
+ * @returns {FilterObject[]} - An array of filter objects each containing the column, operator, and value,
29
37
  * plus an additional object for general search if there is remaining text.
30
38
  */
31
- export function parseFilters(string: string): Object[];
39
+ export function parseFilters(string: string): FilterObject[];
40
+ /**
41
+ * A parsed filter condition.
42
+ */
43
+ export type FilterObject = {
44
+ /**
45
+ * - Column to filter (undefined = search all columns)
46
+ */
47
+ column?: string | undefined;
48
+ /**
49
+ * - Comparison operator
50
+ */
51
+ operator: string;
52
+ /**
53
+ * - Filter value
54
+ */
55
+ value: string | number | RegExp;
56
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/data",
3
- "version": "1.1.18",
3
+ "version": "1.2.0",
4
4
  "description": "Contains generic data manipulation functions that can be used in various components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@lukeed/uuid": "^2.0.1",
41
- "@rokkit/core": "1.1.18",
41
+ "@rokkit/core": "1.2.0",
42
42
  "d3-array": "^3.2.4",
43
43
  "d3-collection": "^1.0.7",
44
44
  "ramda": "^0.32.0",
package/src/parser.js CHANGED
@@ -70,13 +70,22 @@ function processValue(value, operator) {
70
70
  return value
71
71
  }
72
72
 
73
+ /**
74
+ * A parsed filter condition.
75
+ *
76
+ * @typedef {Object} FilterObject
77
+ * @property {string} [column] - Column to filter (undefined = search all columns)
78
+ * @property {string} operator - Comparison operator
79
+ * @property {string|number|RegExp} value - Filter value
80
+ */
81
+
73
82
  /**
74
83
  * Parses a search string and extracts filters based on a predefined regular expression pattern.
75
84
  * Each filter captures column, operator, and value components. Any remaining text that
76
85
  * does not fit the pattern is considered a general search term.
77
86
  *
78
87
  * @param {string} string - The search string to parse for filters.
79
- * @returns {Object[]} - An array of filter objects each containing the column, operator, and value,
88
+ * @returns {FilterObject[]} - An array of filter objects each containing the column, operator, and value,
80
89
  * plus an additional object for general search if there is remaining text.
81
90
  */
82
91
  export function parseFilters(string) {