Skip to content

Commit

Permalink
Fixing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
skocheri committed Nov 2, 2020
1 parent 0aec7ea commit 4a6c09c
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions modules/idLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ function getEmail(value) {
if (!matched) {
return null;
}
logInfo('Email found' + matched[0]);
return matched[0];
}

function hasEmail(value) {
const email = getEmail(value);
return !!email;
}

function bodyAction(conf, mutations, observer) {
logInfo('BODY observer on debounce called');

Expand All @@ -53,10 +49,8 @@ function bodyAction(conf, mutations, observer) {
}

const body = document.body.innerHTML;

if (hasEmail(body)) {
email = getEmail(body);

email = getEmail(body);
if (email != null) {
logInfo(`Email obtained from the body ${email}`);
observer.disconnect();
logInfo('Post data on email found in body');
Expand Down Expand Up @@ -104,9 +98,8 @@ function removeInputElementsElementListner(conf) {
function processInputChange(event, conf) {
const value = event.target.value;
logInfo(`Modified Value of input ${event.target.value}`);
if (hasEmail(value)) {
email = getEmail(value);

email = getEmail(value);
if (email != null) {
logInfo('Email found in input ' + email);
postData(conf.url);
removeInputElementsElementListner(conf);
Expand Down Expand Up @@ -161,9 +154,8 @@ function handleBodyElements(conf) {
postData(conf.url);
return;
}
if (hasEmail(document.body.innerHTML)) {
email = getEmail(document.body.innerHTML);

email = getEmail(document.body.innerHTML);
if (email != null) {
logInfo('Email found in body ' + email);
logInfo(' Post data on email found in the body without observer');
postData(conf.url);
Expand All @@ -182,9 +174,8 @@ function doesInputElementsHaveEmail() {

for (let index = 0; index < inputs.length; ++index) {
const curInput = inputs[index];

if (hasEmail(curInput.value)) {
email = getEmail(curInput.value);
email = getEmail(curInput.value);
if (email != null) {
return true;
}
}
Expand Down

0 comments on commit 4a6c09c

Please sign in to comment.