Skip to content

Commit 3a21ebb

Browse files
committed
Reduced code footprint
1 parent 6e56c37 commit 3a21ebb

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

frontend/src/modules/scaffold/backboneFormsOverrides.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,13 @@ define([
8686

8787
function convertStringsToRegExDeep (arr) {
8888
function processEntry ([key, value]) {
89-
if (typeof value === "string") {
90-
return [
91-
key,
92-
new RegExp(value, 'i')
93-
];
94-
}
95-
if (Array.isArray(value)) {
96-
return [
97-
key,
98-
arr.map((value, index) => processEntry([index, value])[1])
99-
];
100-
}
101-
if (typeof value === "object" && value !== null) {
102-
return [
103-
key,
104-
Object.fromEntries(Object.entries(value).map(processEntry))
105-
];
106-
}
89+
value = (typeof value === "string")
90+
? new RegExp(value, 'i')
91+
: Array.isArray(value)
92+
? arr.map((value, index) => processEntry([index, value])[1])
93+
: (typeof value === "object" && value !== null)
94+
? Object.fromEntries(Object.entries(value).map(processEntry))
95+
: value;
10796
return [key, value];
10897
}
10998
return arr.map((value, index) => processEntry([index, value])[1])

0 commit comments

Comments
 (0)