Comparing version 2.0.0-beta.8 to 2.0.0-beta.9
@@ -40,4 +40,5 @@ /** | ||
var token = tokens[i]; | ||
var validated = token.isLink && _linkify.options.resolve(opts.validate, token.toString(), token.type); | ||
if (token.isLink) { | ||
if (token.isLink && validated) { | ||
@@ -44,0 +45,0 @@ var href = token.toHref(opts.defaultProtocol), |
@@ -98,2 +98,4 @@ 'use strict'; | ||
var token = tokens[i]; | ||
var validated = token.isLink && linkify.options.resolve(opts.validate, token.toString(), token.type); | ||
if (token.type === 'nl' && opts.nl2br) { | ||
@@ -107,3 +109,3 @@ result.push({ | ||
continue; | ||
} else if (!token.isLink) { | ||
} else if (!token.isLink || !validated) { | ||
result.push({ type: Chars, chars: token.toString() }); | ||
@@ -110,0 +112,0 @@ continue; |
@@ -68,3 +68,4 @@ 'use strict'; | ||
target: data.linkifyTarget, | ||
linkClass: data.linkifyLinkclass | ||
linkClass: data.linkifyLinkclass, | ||
validate: data.linkifyValidate | ||
}; | ||
@@ -71,0 +72,0 @@ var $target = target === 'this' ? $this : $this.find(target); |
@@ -41,4 +41,6 @@ /** | ||
var token = tokens[i]; | ||
if (token.isLink) { | ||
var validated = token.isLink && _linkify.options.resolve(opts.validate, token.toString(), token.type); | ||
if (token.isLink && validated) { | ||
var href = token.toHref(opts.defaultProtocol), | ||
@@ -45,0 +47,0 @@ formatted = _linkify.options.resolve(opts.format, token.toString(), token.type), |
@@ -8,2 +8,6 @@ 'use strict'; | ||
function yes(val) { | ||
return true; | ||
} | ||
function typeToTarget(href, type) { | ||
@@ -21,2 +25,3 @@ return type === 'url' ? '_blank' : null; | ||
format: opts.format || noop, | ||
validate: opts.validate || yes, | ||
formatHref: opts.formatHref || noop, | ||
@@ -23,0 +28,0 @@ newLine: opts.newLine || false, // deprecated |
{ | ||
"name": "linkifyjs", | ||
"version": "2.0.0-beta.8", | ||
"version": "2.0.0-beta.9", | ||
"description": "Intelligent link recognition, made easy", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -107,3 +107,3 @@ # Linkify | ||
var linkify = require('linkifyjs'); | ||
require('linkifyjs/plugin/hashtag')(linkify); // optional | ||
require('linkifyjs/plugins/hashtag')(linkify); // optional | ||
var linkifyHtml = require('linkifyjs/html'); | ||
@@ -110,0 +110,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103260
2971