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

concolor

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concolor - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

11

concolor.js

@@ -60,5 +60,9 @@ 'use strict';

) => (
strings, // Array of String
strings, // Array of String or String
...values // Array of String
) => {
if (typeof(strings) === 'string') {
return stylize(styles, strings);
}
const result = [strings[0]];

@@ -74,3 +78,6 @@ let val, str;

module.exports = (strings, ...values) => {
module.exports = (
strings, // Array of String or String
...values // Array of String
) => {
if (typeof(strings) === 'string') {

@@ -77,0 +84,0 @@ return tag(strings);

2

package.json
{
"name": "concolor",
"version": "0.1.2",
"version": "0.1.3",
"author": "Vladyslav Dukhin <vladyslav.dukhin@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Console colors for strings templates in node.js",

@@ -17,14 +17,13 @@ # Concolor

- Require: `const concolor = require('concolor');`
- Place tag `concolor` before templated string to apply coloring on that string,
example:
```javascript
console.log(concolor`Hello ${'World'}(black/green) black on green`);
- Now you have 3 use cases:
- string template tag
- tag factory
- style function
## String tag
```js
console.log(concolor`text ${expression}(styles)`);
```
## Examples:
Use anotations in brackets after templated string to add bold or underlined
style to string or to change foreground or background color of a templated
string, like in examples:
Examples:
```javascript

@@ -39,5 +38,3 @@ console.log(concolor`Hello ${'World'}(blue) blue`);

console.log(concolor`Hello ${'World'}(b,black/green) bold black on green`);
```
```javascript
console.log(concolor`

@@ -50,4 +47,9 @@ Client on ${'192.168.1.1'}(black/green)

## Create semantic template tags
## Tag factory
```js
const tag = concolor(styles);
console.log(tag`text`);
```
Examples:
```javascript

@@ -63,4 +65,21 @@ const warn = concolor('b,yellow');

## Style function
```js
const style = concolor(styles);
console.log(style('text'));
```
Examples:
```javascript
const warn = concolor('b,yellow');
const err = concolor('b,yellow/red');
const inf = concolor('i,white');
console.log(warn(`test1 ${'text2'} text3`));
console.log(err(`test4 ${'text5'} text6`));
console.log(inf(`test7 ${'text8'} text9`));
```
## Contributors
Copyright (c) 2017 [concolor contributors](https://github.com/metarhia/concolor/graphs/contributors)

@@ -49,2 +49,8 @@ 'use strict';

console.log('\nUse tag as a funtion:\n');
console.log(' ' + warn(`test1 ${'text2'} text3`));
console.log(' ' + err(`test4 ${'text5'} text6`));
console.log(' ' + inf(`test7 ${'text8'} text9`));
console.log('\nPassed\n');
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