Skip to content

Commit

Permalink
fix: fix getFbGenderVal function
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 committed Oct 16, 2023
1 parent 45da19d commit af1b105
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/v0/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,16 @@ const hashToSha256 = (value) => sha256(value);
// Check what type of gender and convert to f or m
const getFbGenderVal = (gender) => {
if (
gender.toUpperCase() === 'FEMALE' ||
gender.toUpperCase() === 'F' ||
gender.toUpperCase() === 'WOMAN'
gender.toString().toUpperCase() === 'FEMALE' ||
gender.toString().toUpperCase() === 'F' ||
gender.toString().toUpperCase() === 'WOMAN'
) {
return hashToSha256('f');
}
if (
gender.toUpperCase() === 'MALE' ||
gender.toUpperCase() === 'M' ||
gender.toUpperCase() === 'MAN'
gender.toString().toUpperCase() === 'MALE' ||
gender.toString().toUpperCase() === 'M' ||
gender.toString().toUpperCase() === 'MAN'
) {
return hashToSha256('m');
}
Expand Down Expand Up @@ -2047,11 +2047,11 @@ const getAuthErrCategoryFromStCode = (status) => {
return '';
};

const validateEventType = event => {
if(!event || typeof event !== "string"){
throw new InstrumentationError("Event is a required field and should be a string");
const validateEventType = (event) => {
if (!event || typeof event !== 'string') {
throw new InstrumentationError('Event is a required field and should be a string');
}
}
};
// ========================================================================
// EXPORTS
// ========================================================================
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/data/facebook_pixel_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
"firstname": "Rudder",
"lastname": "Test",
"phone": 9000000000,
"gender": "female"
"gender": 1
},
"app": {
"build": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/data/facebook_pixel_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"JSON_ARRAY": {},
"FORM": {
"data": [
"{\"user_data\":{\"external_id\":\"8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92\",\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"ph\":\"593a6d58f34eb5c3de4f47e38d1faaa7d389fafe332a85400b1e54498391c579\",\"ge\":\"252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111\",\"ln\":\"532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25\",\"fn\":\"2c2ccf28d806f6f9a34b67aa874d2113b7ac1444f1a4092541b8b75b84771747\",\"client_ip_address\":\"0.0.0.0\",\"client_user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36\"},\"event_name\":\"identify\",\"event_time\":1567333011,\"event_id\":\"84e26acc-56a5-4835-8233-591137fca468\",\"action_source\":\"website\"}"
"{\"user_data\":{\"external_id\":\"8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92\",\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"ph\":\"593a6d58f34eb5c3de4f47e38d1faaa7d389fafe332a85400b1e54498391c579\",\"ln\":\"532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25\",\"fn\":\"2c2ccf28d806f6f9a34b67aa874d2113b7ac1444f1a4092541b8b75b84771747\",\"client_ip_address\":\"0.0.0.0\",\"client_user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36\"},\"event_name\":\"identify\",\"event_time\":1567333011,\"event_id\":\"84e26acc-56a5-4835-8233-591137fca468\",\"action_source\":\"website\"}"
]
}
},
Expand Down

0 comments on commit af1b105

Please sign in to comment.