Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

anchorme

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anchorme - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

14

dist-node/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("./util");
const email_1 = require("./tests/email");
const ip_1 = require("./tests/ip");
const url_1 = require("./tests/url");
const transform_1 = require("./transform/transform");
const hasprotocol_1 = require("./tests/hasprotocol");
const anchorme = function (str, options) {
var util_1 = require("./util");
var email_1 = require("./tests/email");
var ip_1 = require("./tests/ip");
var url_1 = require("./tests/url");
var transform_1 = require("./transform/transform");
var hasprotocol_1 = require("./tests/hasprotocol");
var anchorme = function (str, options) {
options = util_1.defaultOptions(options);

@@ -11,0 +11,0 @@ var result = transform_1.default(str, options);

@@ -34,3 +34,3 @@ /**

function fixSeparators(arr, sep1, sep2) {
arr.forEach((bit, i) => {
arr.forEach(function (bit, i) {
if ((bit.indexOf(".") > -1) &&

@@ -57,6 +57,6 @@ (!(arr[i - 1] === sep1 && arr[i + 1] === sep2)) &&

arr = fixSeparators(arr, "[", "]");
arr = fixSeparators(arr, `"`, `"`);
arr = fixSeparators(arr, `'`, `'`);
arr = fixSeparators(arr, "\"", "\"");
arr = fixSeparators(arr, "'", "'");
return arr;
}
exports.default = default_1;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fix_1 = require("./fix");
var fix_1 = require("./fix");
/**

@@ -5,0 +5,0 @@ *

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lists_1 = require("../lists");
var lists_1 = require("../lists");
// pattern that an emails MUST have
const pattern = /^[a-z0-9!#$%&'*+\-/=?^_`{|}~.]+@([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?$/i;
var pattern = /^[a-z0-9!#$%&'*+\-/=?^_`{|}~.]+@([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?$/i;
// patterns that an email can not have
const negativePatterns = [
var negativePatterns = [
/^[!#$%&'*+\-/=?^_`{|}~.]/,

@@ -14,3 +14,3 @@ /[.]{2,}[a-z0-9!#$%&'*+\-/=?^_`{|}~.]+@/i,

// general pattern recognition
const match = str.match(pattern);
var match = str.match(pattern);
if (match === null)

@@ -17,0 +17,0 @@ return false;

@@ -5,13 +5,13 @@ "use strict";

str = str.toLowerCase();
if (str.startsWith("http://"))
if (str.indexOf("http://") === 0)
return "http://";
else if (str.startsWith("https://"))
else if (str.indexOf("https://") === 0)
return "https://";
else if (str.startsWith("ftp://"))
else if (str.indexOf("ftp://") === 0)
return "ftp://";
else if (str.startsWith("ftps://"))
else if (str.indexOf("ftps://") === 0)
return "ftps://";
else if (str.startsWith("file:///"))
else if (str.indexOf("file:///") === 0)
return "file:///";
else if (str.startsWith("mailto:"))
else if (str.indexOf("mailto:") === 0)
return "mailto:";

@@ -18,0 +18,0 @@ else

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
var util_1 = require("../util");
// general IP pattern https://regex101.com/r/rzUcJ4/1
const pattern = /^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?(\/.*)?$/;
var pattern = /^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?(\/.*)?$/;
function default_1(str) {

@@ -7,0 +7,0 @@ if (!pattern.test(str))

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../util");
const lists_1 = require("../lists");
const pattern = /^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i;
var util_1 = require("../util");
var lists_1 = require("../lists");
var pattern = /^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i;
function default_1(str) {
// general pattern recognition https://regex101.com/r/RgKTA4/2
const match = str.match(pattern);
var match = str.match(pattern);
if (match === null)

@@ -10,0 +10,0 @@ return false;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lists_1 = require("../lists");
const hasprotocol_1 = require("../tests/hasprotocol");
const email_1 = require("../tests/email");
const ip_1 = require("../tests/ip");
const url_1 = require("../tests/url");
var lists_1 = require("../lists");
var hasprotocol_1 = require("../tests/hasprotocol");
var email_1 = require("../tests/email");
var ip_1 = require("../tests/ip");
var url_1 = require("../tests/url");
function default_1(inputArr, options) {
return inputArr.map((fragment, index) => {
return inputArr.map(function (fragment, index) {
var encoded = encodeURI(fragment);

@@ -11,0 +11,0 @@ // quick validations

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const separate_1 = require("../separate/separate");
const separate_2 = require("../separate/separate");
const identify_1 = require("./identify");
var separate_1 = require("../separate/separate");
var separate_2 = require("../separate/separate");
var identify_1 = require("./identify");
function default_1(str, options) {

@@ -20,3 +20,3 @@ var arr = separate_1.separate(str);

// transform objects to HTML tags
identified = identified.map((fragment) => {
identified = identified.map(function (fragment) {
if (typeof fragment === "string")

@@ -43,3 +43,3 @@ return fragment;

options.attributes = [];
return `<a href="${href}" ${options.attributes.map((attribute) => {
return "<a href=\"" + href + "\" " + options.attributes.map(function (attribute) {
if (typeof attribute === 'function') {

@@ -51,7 +51,7 @@ var name = (attribute(fragment) || {}).name;

if (name && value)
return ` ${name}="${value}" `;
return " " + name + "=\"" + value + "\" ";
}
else
return ` ${attribute.name}="${attribute.value}" `;
}).join("")}>${original}</a>`;
return " " + attribute.name + "=\"" + attribute.value + "\" ";
}).join("") + ">" + original + "</a>";
}
The MIT License (MIT)
Copyright (c) 2016 Alex Corvi
Copyright (c) 2017 Alex Corvi

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "anchorme",
"version": "1.0.0",
"version": "1.0.1",
"description": "A library to convert URLs to a clickable HTML anchor elements",

@@ -5,0 +5,0 @@ "main": "./dist-node/index.js",

# Anchorme.js
![npm](https://img.shields.io/npm/dm/anchorme.svg)
![npm](https://img.shields.io/npm/v/anchorme.svg)
![GitHub release](https://img.shields.io/github/release/alexcorvi/anchorme.js.svg)
![license](https://img.shields.io/github/license/alexcorvi/anchorme.js.svg)
![David](https://img.shields.io/david/alexcorvi/anchorme.js.svg)
![David](https://img.shields.io/david/dev/alexcorvi/anchorme.js.svg)
A library to convert URLs to a click-able HTML anchor elements
[![Documentation](http://puu.sh/ukS4g/ccc520ade4.jpg)](http://alexcorvi.github.io/anchorme.js/)
Tiny, fast, efficient, feature rich Javascript library to detect links / URLs / Emails in text and convert them to clickable HTML anchor links.
## [Getting Started, Documentations, Demos and more](http://alexcorvi.github.io/anchorme.js/)

@@ -40,2 +48,2 @@

License: The MIT License (MIT) - Copyright (c) 2017 Alex Corvi
License: The MIT License (MIT) - Copyright (c) 2017 Alex Corvi
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc