Skip to content

Commit

Permalink
fix: #53
Browse files Browse the repository at this point in the history
  • Loading branch information
dalbitresb12 committed Jun 10, 2020
1 parent f03c87b commit dcec589
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/obfuscate.js
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import T from 'prop-types';

const Obfuscate = props => {
const Obfuscate = (props) => {
const {
element,
children,
Expand All @@ -27,9 +27,9 @@ const Obfuscate = props => {
let link;

// Combine email header parameters for use with email
const combineHeaders = params => {
const combineHeaders = (params) => {
return Object.keys(params)
.map(key => `${key}=${encodeURIComponent(params[key])}`)
.map((key) => `${key}=${encodeURIComponent(params[key])}`)
.join('&');
};

Expand Down Expand Up @@ -57,14 +57,14 @@ const Obfuscate = props => {
};

const handleClick = () => {
// Allow instantiator to provide an onClick method to be called
// before we change location (e.g. for analytics tracking)
if (onClick && typeof onClick === 'function') {
onClick();
}

// If focused or hovered, this js will be skipped with preference for html
if (humanInteraction === false) {
// Allow instantiator to provide an onClick method to be called
// before we change location (e.g. for analytics tracking)
if (onClick && typeof onClick === 'function') {
onClick();
}

window.location.href = generateLink({
email,
headers,
Expand All @@ -77,14 +77,9 @@ const Obfuscate = props => {
}
};

const reverse = content =>
const reverse = (content) =>
typeof content !== 'undefined' &&
content
.split('')
.reverse()
.join('')
.replace('(', ')')
.replace(')', '(');
content.split('').reverse().join('').replace('(', ')').replace(')', '(');

const obfuscatedStyle = {
...style,
Expand Down

0 comments on commit dcec589

Please sign in to comment.