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

ansi-to-react

Package Overview
Dependencies
Maintainers
1
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 0.0.0 to 0.0.1

.npmignore

42

index.js

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

console.log('soon');
const React = require('react');
const ansiToJSON = require('ansi-to-json');
function ansiJSONtoStyleBundle(ansiBundle) {
const style = {};
if (ansiBundle.bg) {
style.backgroundColor = `rgb(${ansiBundle.bg})`;
}
if (ansiBundle.fg) {
style.color = `rgb(${ansiBundle.fg})`;
}
return {
content: ansiBundle.content,
style,
};
}
function ansiToInlineStyle(text) {
return ansiToJSON(text).map(ansiJSONtoStyleBundle);
}
function inlineBundleToReact(bundle, key) {
return React.createElement('span', {
style: bundle.style,
key,
}, bundle.content);
}
function Ansi(props) {
return React.createElement(
'code',
{},
ansiToInlineStyle(props.children).map(inlineBundleToReact));
}
Ansi.propTypes = {
children: React.PropTypes.string,
};
module.exports = Ansi;

7

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

@@ -14,3 +14,6 @@ "main": "index.js",

"author": "Kyle Kelley <rgbkrk@gmail.com>",
"license": "BSD-3-Clause"
"license": "MPL-2.0",
"dependencies": {
"ansi-to-json": "^1.0.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