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

ansi-to-react

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-to-react - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

5

lib/index.js

@@ -71,7 +71,8 @@ 'use strict';

function Ansi(props) {
return React.createElement('code', {}, props.linkify ? ansiToInlineStyle(props.children).map(linkifyBundle).map(inlineBundleToReact) : ansiToInlineStyle(props.children).map(inlineBundleToReact));
return React.createElement('code', { className: props.className }, props.linkify ? ansiToInlineStyle(props.children).map(linkifyBundle).map(inlineBundleToReact) : ansiToInlineStyle(props.children).map(inlineBundleToReact));
}
Ansi.propTypes = {
children: PropTypes.string
children: PropTypes.string,
className: PropTypes.string
};

@@ -78,0 +79,0 @@

2

package.json
{
"name": "ansi-to-react",
"version": "1.3.0",
"version": "1.4.0",
"description": "ANSI to React Elements",

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

@@ -74,3 +74,3 @@ const React = require('react');

'code',
{},
{className: props.className},
props.linkify

@@ -86,4 +86,5 @@ ? ansiToInlineStyle(props.children)

children: PropTypes.string,
className: PropTypes.string
};
module.exports = Ansi;

@@ -24,2 +24,9 @@ const Ansi = require('../src/index');

it('can have className', () => {
const el = enzyme.shallow(React.createElement(Ansi, {className: 'my-class'}, `hello world`));
expect(el).to.not.be.null;
expect(el.text()).to.equal('hello world');
expect(el.html()).to.equal('<code class="my-class"><span>hello world</span></code>');
});
it('can nest', () => {

@@ -37,3 +44,3 @@ const el = enzyme.shallow(React.createElement(Ansi, null, `hello ${GREEN_FG}wo${YELLOW_BG}rl${RESET}d`));

});
it('can linkify', () => {

@@ -45,3 +52,3 @@ const el = enzyme.shallow(React.createElement(Ansi, {linkify: true}, 'this is a link: https://nteract.io/'));

});
it('can distinguish URL-ish text', () => {

@@ -52,3 +59,3 @@ const el = enzyme.shallow(React.createElement(Ansi, {linkify: true}, '<transport.model.TransportInfo'));

});
it('can distinguish URL-ish text', () => {

@@ -55,0 +62,0 @@ const el = enzyme.shallow(React.createElement(Ansi, {linkify: true}, "<module 'something' from '/usr/local/lib/python2.7/dist-packages/something/__init__.pyc'>"));

Sorry, the diff of this file is not supported yet

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