-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
34 lines (30 loc) · 819 Bytes
/
Copy pathutils.js
File metadata and controls
34 lines (30 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const disallowedValues = [
'[not provided]',
'placeholder',
'[[unknown]]',
'not set',
'not provided',
'unknown',
'undefined',
'n/a'
];
const filterNullValuesFromObject = object =>
Object
.fromEntries(
Object
.entries(object)
.filter(([_, v]) =>
v !== null &&
v !== '' &&
typeof v !== 'undefined' &&
(typeof v !== 'string' || !disallowedValues.includes(v.toLowerCase()) || !v.toLowerCase().includes('!$record'))));
const normalizePropertyName = key => key.toLowerCase().replace(/__c$/, '').replace(/^_+|_+$/g, '').replace(/_+/g, '_');
const goal = actions => {
// this is where the data will be written to the database
console.log(actions);
};
module.exports = {
filterNullValuesFromObject,
normalizePropertyName,
goal
};