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

react-anchorme

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-anchorme - npm Package Compare versions

Comparing version 2.2.1 to 3.0.0

LICENSE

2

dist/Anchorme.d.ts
import React from 'react';
import { AnchorProps, LinkComponent } from './types';
declare type Props = {
type Props = {
children: string;

@@ -5,0 +5,0 @@ linkComponent?: LinkComponent;

/// <reference types="react" />
import { LinkComponent, LinkComponentProps } from './types';
declare type Props = {
type Props = {
linkComponent?: LinkComponent;

@@ -5,0 +5,0 @@ } & LinkComponentProps;

@@ -1,15 +0,1 @@

import t,{useCallback as r,useMemo as n}from"react";import e from"anchorme";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var o=function(){return(o=Object.assign||function(t){for(var r,n=1,e=arguments.length;n<e;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)};function i(t,r){var n={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.indexOf(e)<0&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(e=Object.getOwnPropertySymbols(t);o<e.length;o++)r.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(n[e[o]]=t[e[o]])}return n}var a=/^((file:\/\/\/)|(https?:|ftps?:)\/\/|(mailto:))/i,u=function(t){return function(t){return a.test(t)}(t)?"":e.validate.email(t)?"mailto:":"http://"},l=function(r){var n=r.href,e=r.linkComponent,a=r.truncate,l=i(r,["href","linkComponent","truncate"]),c=null!=e?e:"a",f=u(n),p=a?function(t,r){if("production"!==process.env.NODE_ENV&&r<=0)throw new Error("⚓️ maxLength should be positive number");return t.length>r?t.substring(0,r)+"…":t}(n,a):n;return t.createElement(c,o({},l,{href:""+f+n}),p)},c=t.memo((function(a){var u=a.children,c=i(a,["children"]),f=u,p=r((function(){var r=e.list(f);if(0===r.length)return f;var n=[],i=0;return r.forEach((function(r,e){r.start>i&&n.push(f.substring(i,r.start)),n.push(t.createElement(l,o({},c,{key:e,href:r.string}))),i=r.end})),f.length>i&&n.push(f.substring(i)),1===n.length?n[0]:n}),[f,c]),s=n((function(){return p()}),[p]);return t.createElement(t.Fragment,null,s)}));export{c as Anchorme};
import t,{useCallback as r,useMemo as n}from"react";import e from"anchorme";var o=function(){return o=Object.assign||function(t){for(var r,n=1,e=arguments.length;n<e;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},o.apply(this,arguments)};function i(t,r){var n={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.indexOf(e)<0&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(e=Object.getOwnPropertySymbols(t);o<e.length;o++)r.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(n[e[o]]=t[e[o]])}return n}var a=/^((file:\/\/\/)|(https?:|ftps?:)\/\/|(mailto:))/i,c=function(t){return function(t){return a.test(t)}(t)?"":e.validate.email(t)?"mailto:":"http://"},u=function(r){var n=r.href,e=r.linkComponent,a=r.truncate,u=i(r,["href","linkComponent","truncate"]),l=null!=e?e:"a",f=c(n),p=a?function(t,r){if("production"!==process.env.NODE_ENV&&r<=0)throw new Error("⚓️ maxLength should be positive number");return t.length>r?t.substring(0,r)+"…":t}(n,a):n;return t.createElement(l,o({},u,{href:"".concat(f).concat(n)}),p)},l=t.memo((function(a){var c=a.children,l=i(a,["children"]),f=c,p=r((function(){var r=e.list(f);if(0===r.length)return f;var n=[],i=0;return r.forEach((function(r,e){r.start>i&&n.push(f.substring(i,r.start)),n.push(t.createElement(u,o({},l,{key:e,href:r.string}))),i=r.end})),f.length>i&&n.push(f.substring(i)),1===n.length?n[0]:n}),[f,l]),s=n((function(){return p()}),[p]);return t.createElement(t.Fragment,null,s)}));export{l as Anchorme};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("anchorme");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(e),u=r(t),o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]])}return r}var l=/^((file:\/\/\/)|(https?:|ftps?:)\/\/|(mailto:))/i,i=function(e){return function(e){return l.test(e)}(e)?"":u.default.validate.email(e)?"mailto:":"http://"},f=function(e){var t=e.href,r=e.linkComponent,u=e.truncate,l=a(e,["href","linkComponent","truncate"]),f=null!=r?r:"a",c=i(t),s=u?function(e,t){if("production"!==process.env.NODE_ENV&&t<=0)throw new Error("⚓️ maxLength should be positive number");return e.length>t?e.substring(0,t)+"…":e}(t,u):t;return n.default.createElement(f,o({},l,{href:""+c+t}),s)},c=n.default.memo((function(t){var r=t.children,l=a(t,["children"]),i=r,c=e.useCallback((function(){var e=u.default.list(i);if(0===e.length)return i;var t=[],r=0;return e.forEach((function(e,u){e.start>r&&t.push(i.substring(r,e.start)),t.push(n.default.createElement(f,o({},l,{key:u,href:e.string}))),r=e.end})),i.length>r&&t.push(i.substring(r)),1===t.length?t[0]:t}),[i,l]),s=e.useMemo((function(){return c()}),[c]);return n.default.createElement(n.default.Fragment,null,s)}));exports.Anchorme=c;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("anchorme");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(t),o=r(e),u=function(){return u=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},u.apply(this,arguments)};function a(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}var l=/^((file:\/\/\/)|(https?:|ftps?:)\/\/|(mailto:))/i,i=function(t){return function(t){return l.test(t)}(t)?"":o.default.validate.email(t)?"mailto:":"http://"},c=function(t){var e=t.href,r=t.linkComponent,o=t.truncate,l=a(t,["href","linkComponent","truncate"]),c=null!=r?r:"a",f=i(e),s=o?function(t,e){if("production"!==process.env.NODE_ENV&&e<=0)throw new Error("⚓️ maxLength should be positive number");return t.length>e?t.substring(0,e)+"…":t}(e,o):e;return n.default.createElement(c,u({},l,{href:"".concat(f).concat(e)}),s)},f=n.default.memo((function(e){var r=e.children,l=a(e,["children"]),i=r,f=t.useCallback((function(){var t=o.default.list(i);if(0===t.length)return i;var e=[],r=0;return t.forEach((function(t,o){t.start>r&&e.push(i.substring(r,t.start)),e.push(n.default.createElement(c,u({},l,{key:o,href:t.string}))),r=t.end})),i.length>r&&e.push(i.substring(r)),1===e.length?e[0]:e}),[i,l]),s=t.useMemo((function(){return f()}),[f]);return n.default.createElement(n.default.Fragment,null,s)}));exports.Anchorme=f;
import React from 'react';
export declare type AnchorProps = Omit<React.HTMLProps<HTMLAnchorElement>, 'href'> & {
export type AnchorProps = Omit<React.HTMLProps<HTMLAnchorElement>, 'href'> & {
truncate?: number;
};
export declare type LinkComponentProps = {
export type LinkComponentProps = {
href: string;
} & AnchorProps;
export declare type LinkComponent = React.ElementType<LinkComponentProps>;
export type LinkComponent = React.ElementType<LinkComponentProps>;
{
"name": "react-anchorme",
"version": "2.2.1",
"version": "3.0.0",
"description": "React component to detect links in text and make them clickable",

@@ -34,29 +34,30 @@ "repository": "https://github.com/potty/react-anchorme",

"peerDependencies": {
"react": "^16.8.0 || ^17"
"react": "^16.8.0 || ^17 || ^18"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.5.0",
"@testing-library/react": "^11.0.2",
"@types/jest": "^26.0.13",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"eslint": "^7.0.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^4.0.0",
"husky": "^6.0.0",
"jest": "^27.0.4",
"lint-staged": "^11.0.0",
"prettier": "^2.0.5",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.4.0",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"lint-staged": "^13.1.0",
"prettier": "^2.8.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^2.7.5",
"rollup-plugin-sizes": "^1.0.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^27.0.3",
"rollup-plugin-typescript2": "^0.34.1",
"ts-jest": "^29.0.5",
"typescript": "^4.0.2"

@@ -63,0 +64,0 @@ },

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