@react-querybuilder/core 8.9.0 → 8.9.2

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.
Files changed (60) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/arrayUtils-BF1P8iHS.mjs +122 -0
  3. package/dist/arrayUtils-BF1P8iHS.mjs.map +1 -0
  4. package/dist/basic-BfD-7CN3.d.mts +1235 -0
  5. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +21 -10
  6. package/dist/cjs/react-querybuilder_core.cjs.development.js +22 -19
  7. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  8. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +21 -10
  9. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  10. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  11. package/dist/convertQuery-H7RhQiIc.mjs +75 -0
  12. package/dist/convertQuery-H7RhQiIc.mjs.map +1 -0
  13. package/dist/export-r-V7bU31.d.mts +452 -0
  14. package/dist/formatQuery.d.mts +667 -0
  15. package/dist/formatQuery.mjs +2366 -0
  16. package/dist/formatQuery.mjs.map +1 -0
  17. package/dist/import-BwbbP4oU.d.mts +28 -0
  18. package/dist/isRuleGroup-CnhYpLOM.mjs +40 -0
  19. package/dist/isRuleGroup-CnhYpLOM.mjs.map +1 -0
  20. package/dist/isRuleGroup-DqAs2x4E.js.map +1 -1
  21. package/dist/objectUtils-BtWdcZVG.mjs +11 -0
  22. package/dist/objectUtils-BtWdcZVG.mjs.map +1 -0
  23. package/dist/optGroupUtils-Duv-M8rf.mjs +102 -0
  24. package/dist/optGroupUtils-Duv-M8rf.mjs.map +1 -0
  25. package/dist/parseCEL.d.mts +34 -0
  26. package/dist/parseCEL.mjs +2593 -0
  27. package/dist/parseCEL.mjs.map +1 -0
  28. package/dist/parseJSONata.d.mts +36 -0
  29. package/dist/parseJSONata.mjs +268 -0
  30. package/dist/parseJSONata.mjs.map +1 -0
  31. package/dist/parseJsonLogic.d.mts +36 -0
  32. package/dist/parseJsonLogic.mjs +191 -0
  33. package/dist/parseJsonLogic.mjs.map +1 -0
  34. package/dist/parseMongoDB.d.mts +79 -0
  35. package/dist/parseMongoDB.mjs +267 -0
  36. package/dist/parseMongoDB.mjs.map +1 -0
  37. package/dist/parseNumber-BtGKa58z.mjs +24 -0
  38. package/dist/parseNumber-BtGKa58z.mjs.map +1 -0
  39. package/dist/parseSQL.d.mts +37 -0
  40. package/dist/parseSQL.mjs +6626 -0
  41. package/dist/parseSQL.mjs.map +1 -0
  42. package/dist/parseSpEL.d.mts +34 -0
  43. package/dist/parseSpEL.mjs +273 -0
  44. package/dist/parseSpEL.mjs.map +1 -0
  45. package/dist/prepareQueryObjects-CS6Wmhmf.mjs +154 -0
  46. package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +1 -0
  47. package/dist/react-querybuilder_core.d.mts +21 -10
  48. package/dist/react-querybuilder_core.legacy-esm.d.ts +21 -10
  49. package/dist/react-querybuilder_core.legacy-esm.js +19 -18
  50. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  51. package/dist/react-querybuilder_core.mjs +22 -20
  52. package/dist/react-querybuilder_core.mjs.map +1 -1
  53. package/dist/react-querybuilder_core.production.d.mts +21 -10
  54. package/dist/react-querybuilder_core.production.mjs +1 -1
  55. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  56. package/dist/transformQuery-DdMvmrCh.mjs +41 -0
  57. package/dist/transformQuery-DdMvmrCh.mjs.map +1 -0
  58. package/dist/transformQuery.d.mts +118 -0
  59. package/dist/transformQuery.mjs +4 -0
  60. package/package.json +68 -19
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Jake Boone and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,122 @@
1
+ //#region src/defaults.ts
2
+ /**
3
+ * @group Defaults
4
+ */
5
+ const defaultPlaceholderName = "~";
6
+ /**
7
+ * Default `name` for placeholder option in the `fields` array.
8
+ *
9
+ * @group Defaults
10
+ */
11
+ const defaultPlaceholderFieldName = defaultPlaceholderName;
12
+ /**
13
+ * Default `name` for placeholder option in the `operators` array.
14
+ *
15
+ * @group Defaults
16
+ */
17
+ const defaultPlaceholderOperatorName = defaultPlaceholderName;
18
+ /**
19
+ * Default character used to `.join` and `.split` arrays.
20
+ *
21
+ * @group Defaults
22
+ */
23
+ const defaultJoinChar = ",";
24
+ /**
25
+ * Map of default operators to their respective opposite/negating operators.
26
+ *
27
+ * @group Defaults
28
+ */
29
+ const defaultOperatorNegationMap = {
30
+ "=": "!=",
31
+ "!=": "=",
32
+ "<": ">=",
33
+ "<=": ">",
34
+ ">": "<=",
35
+ ">=": "<",
36
+ beginsWith: "doesNotBeginWith",
37
+ doesNotBeginWith: "beginsWith",
38
+ endsWith: "doesNotEndWith",
39
+ doesNotEndWith: "endsWith",
40
+ contains: "doesNotContain",
41
+ doesNotContain: "contains",
42
+ between: "notBetween",
43
+ notBetween: "between",
44
+ in: "notIn",
45
+ notIn: "in",
46
+ notNull: "null",
47
+ null: "notNull"
48
+ };
49
+ /**
50
+ * Default combinator list.
51
+ *
52
+ * @group Defaults
53
+ */
54
+ const defaultCombinators = [{
55
+ name: "and",
56
+ value: "and",
57
+ label: "AND"
58
+ }, {
59
+ name: "or",
60
+ value: "or",
61
+ label: "OR"
62
+ }];
63
+ /**
64
+ * Default combinator list, with `XOR` added.
65
+ *
66
+ * @group Defaults
67
+ */
68
+ const defaultCombinatorsExtended = [...defaultCombinators, {
69
+ name: "xor",
70
+ value: "xor",
71
+ label: "XOR"
72
+ }];
73
+
74
+ //#endregion
75
+ //#region src/utils/arrayUtils.ts
76
+ /**
77
+ * Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
78
+ * (characters preceded by a backslash) will not apply to the split, and the backslash will
79
+ * be removed in the array element. Inverse of {@link joinWith}.
80
+ *
81
+ * @example
82
+ * splitBy('this\\,\\,that,,the other,,,\\,')
83
+ * // or
84
+ * splitBy('this\\,\\,that,,the other,,,\\,', ',')
85
+ * // would return
86
+ * ['this,,that', '', 'the other', '', '', ',']
87
+ */
88
+ const splitBy = (str, splitChar = defaultJoinChar) => typeof str === "string" ? str.split(`\\${splitChar}`).map((c) => c.split(splitChar)).reduce((prev, curr, idx) => {
89
+ if (idx === 0) return curr;
90
+ return [
91
+ ...prev.slice(0, -1),
92
+ `${prev.at(-1)}${splitChar}${curr[0]}`,
93
+ ...curr.slice(1)
94
+ ];
95
+ }, []) : [];
96
+ /**
97
+ * Joins an array of strings using the given character (see {@link defaultJoinChar}). When
98
+ * the given character appears in an array element, a backslash will be added just before it
99
+ * to distinguish it from the join character. Effectively the inverse of {@link splitBy}.
100
+ *
101
+ * TIP: The join character can actually be a string of any length. Only the first character
102
+ * will be searched for in the array elements and preceded by a backslash.
103
+ *
104
+ * @example
105
+ * joinWith(['this,,that', '', 'the other', '', '', ','], ', ')
106
+ * // would return
107
+ * 'this\\,\\,that, , the other, , , \\,'
108
+ */
109
+ const joinWith = (strArr, joinChar = defaultJoinChar) => strArr.map((str) => `${str ?? ""}`.replaceAll(joinChar[0], `\\${joinChar[0]}`)).join(joinChar);
110
+ /**
111
+ * Trims the value if it is a string. Otherwise returns the value as is.
112
+ */
113
+ const trimIfString = (val) => typeof val === "string" ? val.trim() : val;
114
+ /**
115
+ * Splits a string by comma then trims each element. Arrays are returned as is except
116
+ * any string elements are trimmed.
117
+ */
118
+ const toArray = (v, { retainEmptyStrings } = {}) => Array.isArray(v) ? v.map((v$1) => trimIfString(v$1)) : typeof v === "string" ? splitBy(v, defaultJoinChar).filter(retainEmptyStrings ? () => true : (s) => !/^\s*$/.test(s)).map((s) => s.trim()) : typeof v === "number" ? [v] : [];
119
+
120
+ //#endregion
121
+ export { defaultOperatorNegationMap, defaultPlaceholderFieldName, defaultPlaceholderOperatorName, joinWith, splitBy, toArray, trimIfString };
122
+ //# sourceMappingURL=arrayUtils-BF1P8iHS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayUtils-BF1P8iHS.mjs","names":["defaultPlaceholderFieldName: typeof defaultPlaceholderName","defaultPlaceholderOperatorName: typeof defaultPlaceholderName","defaultOperatorNegationMap: Record<DefaultOperatorName, DefaultOperatorName>","defaultCombinators: DefaultCombinators","defaultCombinatorsExtended: DefaultCombinatorsExtended","v"],"sources":["../src/defaults.ts","../src/utils/arrayUtils.ts"],"sourcesContent":["import type {\n Classnames,\n DefaultCombinatorName,\n DefaultCombinatorNameExtended,\n DefaultOperatorName,\n MatchMode,\n Path,\n StringUnionToFullOptionArray,\n} from './types';\n\n// DO NOT ALTER OR REMOVE REGION NAMES. Some of them are used\n// to generate code snippets in the documentation.\n\n/**\n * @group Defaults\n */\nexport const defaultPlaceholderName = '~';\n/**\n * @group Defaults\n */\nexport const defaultPlaceholderLabel = '------';\n/**\n * Default `name` for placeholder option in the `fields` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderFieldName: typeof defaultPlaceholderName = defaultPlaceholderName;\n/**\n * Default `label` for placeholder option in the `fields` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderFieldLabel: typeof defaultPlaceholderLabel = defaultPlaceholderLabel;\n/**\n * Default `label` for placeholder option group in the `fields` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderFieldGroupLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n/**\n * Default `name` for placeholder option in the `operators` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderOperatorName: typeof defaultPlaceholderName = defaultPlaceholderName;\n/**\n * Default `label` for placeholder option in the `operators` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderOperatorLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n/**\n * Default `label` for placeholder option group in the `operators` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderOperatorGroupLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n/**\n * Default `name` for placeholder option in the `values` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderValueName: typeof defaultPlaceholderName = defaultPlaceholderName;\n/**\n * Default `label` for placeholder option in the `values` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderValueLabel: typeof defaultPlaceholderLabel = defaultPlaceholderLabel;\n/**\n * Default `label` for placeholder option group in the `values` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderValueGroupLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n\n/**\n * Default character used to `.join` and `.split` arrays.\n *\n * @group Defaults\n */\nexport const defaultJoinChar = ',';\n\nexport type DefaultOperators = StringUnionToFullOptionArray<DefaultOperatorName>;\n\nexport const defaultOperatorLabelMap: Record<DefaultOperatorName, string> = {\n '=': '=',\n '!=': '!=',\n '<': '<',\n '>': '>',\n '<=': '<=',\n '>=': '>=',\n contains: 'contains',\n beginsWith: 'begins with',\n endsWith: 'ends with',\n doesNotContain: 'does not contain',\n doesNotBeginWith: 'does not begin with',\n doesNotEndWith: 'does not end with',\n null: 'is null',\n notNull: 'is not null',\n in: 'in',\n notIn: 'not in',\n between: 'between',\n notBetween: 'not between',\n};\n\nexport const defaultCombinatorLabelMap: Record<DefaultCombinatorNameExtended, string> = {\n and: 'AND',\n or: 'OR',\n xor: 'XOR',\n};\n\n/**\n * Default operator list.\n *\n * @group Defaults\n */\n// #region docs-operators\nexport const defaultOperators: DefaultOperators = [\n { name: '=', value: '=', label: '=' },\n { name: '!=', value: '!=', label: '!=' },\n { name: '<', value: '<', label: '<' },\n { name: '>', value: '>', label: '>' },\n { name: '<=', value: '<=', label: '<=' },\n { name: '>=', value: '>=', label: '>=' },\n { name: 'contains', value: 'contains', label: 'contains' },\n { name: 'beginsWith', value: 'beginsWith', label: 'begins with' },\n { name: 'endsWith', value: 'endsWith', label: 'ends with' },\n { name: 'doesNotContain', value: 'doesNotContain', label: 'does not contain' },\n { name: 'doesNotBeginWith', value: 'doesNotBeginWith', label: 'does not begin with' },\n { name: 'doesNotEndWith', value: 'doesNotEndWith', label: 'does not end with' },\n { name: 'null', value: 'null', label: 'is null' },\n { name: 'notNull', value: 'notNull', label: 'is not null' },\n { name: 'in', value: 'in', label: 'in' },\n { name: 'notIn', value: 'notIn', label: 'not in' },\n { name: 'between', value: 'between', label: 'between' },\n { name: 'notBetween', value: 'notBetween', label: 'not between' },\n];\n// #endregion\n\n/**\n * Map of default operators to their respective opposite/negating operators.\n *\n * @group Defaults\n */\nexport const defaultOperatorNegationMap: Record<DefaultOperatorName, DefaultOperatorName> = {\n '=': '!=',\n '!=': '=',\n '<': '>=',\n '<=': '>',\n '>': '<=',\n '>=': '<',\n beginsWith: 'doesNotBeginWith',\n doesNotBeginWith: 'beginsWith',\n endsWith: 'doesNotEndWith',\n doesNotEndWith: 'endsWith',\n contains: 'doesNotContain',\n doesNotContain: 'contains',\n between: 'notBetween',\n notBetween: 'between',\n in: 'notIn',\n notIn: 'in',\n notNull: 'null',\n null: 'notNull',\n} satisfies Record<DefaultOperatorName, DefaultOperatorName>;\n\nexport type DefaultCombinators = StringUnionToFullOptionArray<DefaultCombinatorName>;\n\n/**\n * Default combinator list.\n *\n * @group Defaults\n */\n// #region docs-combinators\nexport const defaultCombinators: DefaultCombinators = [\n { name: 'and', value: 'and', label: 'AND' } as const,\n { name: 'or', value: 'or', label: 'OR' } as const,\n];\n// #endregion\n\nexport type DefaultCombinatorsExtended =\n StringUnionToFullOptionArray<DefaultCombinatorNameExtended>;\n\n/**\n * Default combinator list, with `XOR` added.\n *\n * @group Defaults\n */\nexport const defaultCombinatorsExtended: DefaultCombinatorsExtended = [\n ...defaultCombinators,\n { name: 'xor', value: 'xor', label: 'XOR' } as const,\n];\n\nexport type DefaultMatchModes = StringUnionToFullOptionArray<MatchMode>;\n\n/**\n * Default match modes.\n *\n * @group Defaults\n */\n// #region docs-matchmodes\nexport const defaultMatchModes: DefaultMatchModes = [\n { name: 'all', value: 'all', label: 'all' },\n { name: 'some', value: 'some', label: 'some' },\n { name: 'none', value: 'none', label: 'none' },\n { name: 'atLeast', value: 'atLeast', label: 'at least' },\n { name: 'atMost', value: 'atMost', label: 'at most' },\n { name: 'exactly', value: 'exactly', label: 'exactly' },\n];\n// #endregion\n\n/**\n * Standard classnames applied to each component.\n *\n * @group Defaults\n */\n// #region docs-standardclassnames\nexport const standardClassnames = {\n queryBuilder: 'queryBuilder',\n ruleGroup: 'ruleGroup',\n header: 'ruleGroup-header',\n body: 'ruleGroup-body',\n combinators: 'ruleGroup-combinators',\n addRule: 'ruleGroup-addRule',\n addGroup: 'ruleGroup-addGroup',\n cloneRule: 'rule-cloneRule',\n cloneGroup: 'ruleGroup-cloneGroup',\n removeGroup: 'ruleGroup-remove',\n notToggle: 'ruleGroup-notToggle',\n rule: 'rule',\n fields: 'rule-fields',\n matchMode: 'rule-matchMode',\n matchThreshold: 'rule-matchThreshold',\n operators: 'rule-operators',\n value: 'rule-value',\n removeRule: 'rule-remove',\n betweenRules: 'betweenRules',\n valid: 'queryBuilder-valid',\n invalid: 'queryBuilder-invalid',\n shiftActions: 'shiftActions',\n dndDragging: 'dndDragging',\n dndOver: 'dndOver',\n dndCopy: 'dndCopy',\n dndGroup: 'dndGroup',\n dndDropNotAllowed: 'dndDropNotAllowed',\n dragHandle: 'queryBuilder-dragHandle',\n disabled: 'queryBuilder-disabled',\n lockRule: 'rule-lock',\n lockGroup: 'ruleGroup-lock',\n valueSource: 'rule-valueSource',\n valueListItem: 'rule-value-list-item',\n branches: 'queryBuilder-branches',\n justified: 'queryBuilder-justified',\n hasSubQuery: 'rule-hasSubQuery',\n} as const;\n// #endregion\n\n/**\n * Default classnames for each component.\n *\n * @group Defaults\n */\nexport const defaultControlClassnames: Classnames = {\n queryBuilder: '',\n ruleGroup: '',\n header: '',\n body: '',\n combinators: '',\n addRule: '',\n addGroup: '',\n cloneRule: '',\n cloneGroup: '',\n removeGroup: '',\n notToggle: '',\n rule: '',\n fields: '',\n matchMode: '',\n matchThreshold: '',\n operators: '',\n value: '',\n removeRule: '',\n shiftActions: '',\n dragHandle: '',\n lockRule: '',\n lockGroup: '',\n valueSource: '',\n actionElement: '',\n valueSelector: '',\n betweenRules: '',\n valid: '',\n invalid: '',\n dndDragging: '',\n dndOver: '',\n dndGroup: '',\n dndCopy: '',\n dndDropNotAllowed: '',\n disabled: '',\n valueListItem: '',\n branches: '',\n hasSubQuery: '',\n} satisfies Classnames;\n\n/**\n * Default reason codes for a group being invalid.\n *\n * @group Defaults\n */\nexport const groupInvalidReasons = {\n empty: 'empty',\n invalidCombinator: 'invalid combinator',\n invalidIndependentCombinators: 'invalid independent combinators',\n} as const;\n\n/**\n * Component identifiers for testing.\n *\n * @group Defaults\n */\nexport const TestID = {\n rule: 'rule',\n ruleGroup: 'rule-group',\n inlineCombinator: 'inline-combinator',\n addGroup: 'add-group',\n removeGroup: 'remove-group',\n cloneGroup: 'clone-group',\n cloneRule: 'clone-rule',\n addRule: 'add-rule',\n removeRule: 'remove-rule',\n combinators: 'combinators',\n fields: 'fields',\n operators: 'operators',\n valueEditor: 'value-editor',\n notToggle: 'not-toggle',\n shiftActions: 'shift-actions',\n dragHandle: 'drag-handle',\n lockRule: 'lock-rule',\n lockGroup: 'lock-group',\n valueSourceSelector: 'value-source-selector',\n matchModeEditor: 'match-mode-editor',\n} as const;\n\nexport const LogType = {\n parentPathDisabled: 'action aborted: parent path disabled',\n pathDisabled: 'action aborted: path is disabled',\n queryUpdate: 'query updated',\n onAddRuleFalse: 'onAddRule callback returned false',\n onAddGroupFalse: 'onAddGroup callback returned false',\n onGroupRuleFalse: 'onGroupRule callback returned false',\n onGroupGroupFalse: 'onGroupGroup callback returned false',\n onMoveRuleFalse: 'onMoveRule callback returned false',\n onMoveGroupFalse: 'onMoveGroup callback returned false',\n onRemoveFalse: 'onRemove callback returned false',\n add: 'rule or group added',\n remove: 'rule or group removed',\n update: 'rule or group updated',\n move: 'rule or group moved',\n group: 'rule or group grouped with another',\n} as const;\n\n/**\n * The {@link Path} of the root group.\n *\n * @group Defaults\n */\nexport const rootPath: Path = [] satisfies Path;\n","import { defaultJoinChar } from '../defaults';\n\n/**\n * Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters\n * (characters preceded by a backslash) will not apply to the split, and the backslash will\n * be removed in the array element. Inverse of {@link joinWith}.\n *\n * @example\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,')\n * // or\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,', ',')\n * // would return\n * ['this,,that', '', 'the other', '', '', ',']\n */\nexport const splitBy = (str?: string, splitChar: string = defaultJoinChar): string[] =>\n typeof str === 'string'\n ? str\n .split(`\\\\${splitChar}`)\n .map(c => c.split(splitChar))\n .reduce((prev, curr, idx) => {\n if (idx === 0) {\n return curr;\n }\n return [...prev.slice(0, -1), `${prev.at(-1)}${splitChar}${curr[0]}`, ...curr.slice(1)];\n }, [])\n : [];\n\n/**\n * Joins an array of strings using the given character (see {@link defaultJoinChar}). When\n * the given character appears in an array element, a backslash will be added just before it\n * to distinguish it from the join character. Effectively the inverse of {@link splitBy}.\n *\n * TIP: The join character can actually be a string of any length. Only the first character\n * will be searched for in the array elements and preceded by a backslash.\n *\n * @example\n * joinWith(['this,,that', '', 'the other', '', '', ','], ', ')\n * // would return\n * 'this\\\\,\\\\,that, , the other, , , \\\\,'\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const joinWith = (strArr: any[], joinChar: string = defaultJoinChar): string =>\n strArr.map(str => `${str ?? ''}`.replaceAll(joinChar[0], `\\\\${joinChar[0]}`)).join(joinChar);\n\n/**\n * Trims the value if it is a string. Otherwise returns the value as is.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const trimIfString = (val: any): any => (typeof val === 'string' ? val.trim() : val);\n\n/**\n * Splits a string by comma then trims each element. Arrays are returned as is except\n * any string elements are trimmed.\n */\nexport const toArray = (\n // oxlint-disable-next-line typescript/no-explicit-any\n v: any,\n { retainEmptyStrings }: { retainEmptyStrings?: boolean } = {}\n // oxlint-disable-next-line typescript/no-explicit-any\n): any[] =>\n Array.isArray(v)\n ? v.map(v => trimIfString(v))\n : typeof v === 'string'\n ? splitBy(v, defaultJoinChar)\n .filter(retainEmptyStrings ? () => true : s => !/^\\s*$/.test(s))\n .map(s => s.trim())\n : typeof v === 'number'\n ? [v]\n : [];\n\n/**\n * Determines if an array is free of `null`/`undefined`.\n */\nexport const nullFreeArray = <T>(arr: T[]): arr is Exclude<T, null>[] =>\n arr.every(el => el === false || (el ?? false) !== false);\n"],"mappings":";;;;AAgBA,MAAa,yBAAyB;;;;;;AAUtC,MAAaA,8BAA6D;;;;;;AAmB1E,MAAaC,iCAAgE;;;;;;AAwC7E,MAAa,kBAAkB;;;;;;AAgE/B,MAAaC,6BAA+E;CAC1F,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,YAAY;CACZ,kBAAkB;CAClB,UAAU;CACV,gBAAgB;CAChB,UAAU;CACV,gBAAgB;CAChB,SAAS;CACT,YAAY;CACZ,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACP;;;;;;AAUD,MAAaC,qBAAyC,CACpD;CAAE,MAAM;CAAO,OAAO;CAAO,OAAO;CAAO,EAC3C;CAAE,MAAM;CAAM,OAAO;CAAM,OAAO;CAAM,CACzC;;;;;;AAWD,MAAaC,6BAAyD,CACpE,GAAG,oBACH;CAAE,MAAM;CAAO,OAAO;CAAO,OAAO;CAAO,CAC5C;;;;;;;;;;;;;;;;ACrLD,MAAa,WAAW,KAAc,YAAoB,oBACxD,OAAO,QAAQ,WACX,IACG,MAAM,KAAK,YAAY,CACvB,KAAI,MAAK,EAAE,MAAM,UAAU,CAAC,CAC5B,QAAQ,MAAM,MAAM,QAAQ;AAC3B,KAAI,QAAQ,EACV,QAAO;AAET,QAAO;EAAC,GAAG,KAAK,MAAM,GAAG,GAAG;EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,YAAY,KAAK;EAAM,GAAG,KAAK,MAAM,EAAE;EAAC;GACtF,EAAE,CAAC,GACR,EAAE;;;;;;;;;;;;;;AAgBR,MAAa,YAAY,QAAe,WAAmB,oBACzD,OAAO,KAAI,QAAO,GAAG,OAAO,KAAK,WAAW,SAAS,IAAI,KAAK,SAAS,KAAK,CAAC,CAAC,KAAK,SAAS;;;;AAM9F,MAAa,gBAAgB,QAAmB,OAAO,QAAQ,WAAW,IAAI,MAAM,GAAG;;;;;AAMvF,MAAa,WAEX,GACA,EAAE,uBAAyD,EAAE,KAG7D,MAAM,QAAQ,EAAE,GACZ,EAAE,KAAI,QAAK,aAAaC,IAAE,CAAC,GAC3B,OAAO,MAAM,WACX,QAAQ,GAAG,gBAAgB,CACxB,OAAO,2BAA2B,QAAO,MAAK,CAAC,QAAQ,KAAK,EAAE,CAAC,CAC/D,KAAI,MAAK,EAAE,MAAM,CAAC,GACrB,OAAO,MAAM,WACX,CAAC,EAAE,GACH,EAAE"}