New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

erte

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

erte

String difference with colour for Node.js.

  • 1.1.0
  • npm
  • Socket score

Version published
Weekly downloads
71
increased by10.94%
Maintainers
1
Weekly downloads
 
Created
Source

erte

erte

erte is an npm package to show string difference with colour.

yarn add erte

erte(source: string, target: string): string

This function will compare the strings using diff package, and color the differences with green or red.

import erte from 'erte'

const s = 'test this string'
const e = 'test this string with extra data'
const m = 'test this'

const green = erte(s, e)
console.log(green)

const red = erte(s, m)
console.log(red)

const grey = erte(s, s)
console.log(grey)

extra

missing

same

c(s: string, t:'red'|'green'|'grey'): string

This function will color the foreground with red, green or grey colors.

/** yarn example-c */
import { c } from 'erte'

const redText = c('RED ALERT', 'red')
console.log(`.${redText}`) // eslint-disable-line
yarn example-c

c

b(s: string, t:'red'|'green'): string

This function will color the background with red or green colors.

/** yarn example-b */
import { b } from 'erte'

const greenText = b('VEGAN', 'green')
console.log(`.${greenText}`) // eslint-disable-line
yarn example-b

b


(c) Art Deco Code 2018

Artwork by Erte.

Keywords

FAQs

Package last updated on 12 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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