Skip to content

Commit

Permalink
Remove obsolete check
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierluigi Cau committed Feb 2, 2016
1 parent f43e5dc commit 1d91cd6
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/js/components/AutolinkComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ var React = require("react/addons");

const URLDelimiter = /(https?:\/\/[^\s]+)/gi;

const startsWith = (str, prefix) => {
return str.slice(0, prefix.length) === prefix;
};

var AutolinkComponent = React.createClass({
displayName: "AutolinkComponent",

Expand All @@ -36,18 +32,11 @@ var AutolinkComponent = React.createClass({
var match = word.match(URLDelimiter);
if (match) {
let url = match[0];
let segments = url.split("/");
// no scheme given, so check host portion length
if (segments[1] !== "" && segments[0].length < 5) {
return word;
}

return React.createElement("a",
Object.assign({}, {
key: `autolink-${url}`,
href: startsWith(url, "http")
? url
: `http://${url}`
href: url
}, this.props.options),
url
);
Expand Down

0 comments on commit 1d91cd6

Please sign in to comment.