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

json-colorizer

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-colorizer - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

14

index.js
const colorize = require('./src/lib');
const jsonString = JSON.stringify({ foo: 'bar' }, null, 2);
console.log(
colorize(
{ foo: 'bar' },
{
colors: {
STRING_LITERAL: '#FF0000'
}
colorize(jsonString, {
colors: {
STRING_LITERAL: '#FF0000'
}
)
})
);
{
"name": "json-colorizer",
"version": "2.1.0",
"version": "2.1.1",
"description": "A library to format JSON with colors for display in the console",

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

@@ -22,3 +22,3 @@ const chalk = require('chalk');

const colorKey = colors[token.type] || defaultColors[token.type];
const colorFn = colorKey[0] === '#' ? chalk.hex(colorKey) : get(chalk, colorKey);
const colorFn = colorKey && colorKey[0] === '#' ? chalk.hex(colorKey) : get(chalk, colorKey);

@@ -25,0 +25,0 @@ return acc + (colorFn ? colorFn(token.value) : token.value);

@@ -25,2 +25,6 @@ const { expect } = require('chai');

describe('Colorizer', function() {
it('does not throw an error when there is whitespace', function() {
expect(() => colorize(getTokens(JSON.stringify(fixture, null, 2)))).to.not.throw();
});
it('colorizes with default options', function() {

@@ -27,0 +31,0 @@ const tokens = getTokens(fixture);

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