log-symbols
Advanced tools
Comparing version 1.0.2 to 2.0.0
30
index.js
'use strict'; | ||
var chalk = require('chalk'); | ||
const os = require('os'); | ||
const chalk = require('chalk'); | ||
var main = { | ||
const isSupported = (() => { | ||
if (process.platform !== 'win32' || process.env.CI) { | ||
return true; | ||
} | ||
if (process.env.ConEmuDir) { | ||
return false; | ||
} | ||
// Windows 10 | ||
const osRelease = os.release().split('.'); | ||
if ( | ||
Number(osRelease[0]) >= 10 && | ||
Number(osRelease[2]) >= 10586 | ||
) { | ||
return true; | ||
} | ||
return false; | ||
})(); | ||
const main = { | ||
info: chalk.blue('ℹ'), | ||
@@ -11,3 +33,3 @@ success: chalk.green('✔'), | ||
var win = { | ||
const fallbacks = { | ||
info: chalk.blue('i'), | ||
@@ -19,2 +41,2 @@ success: chalk.green('√'), | ||
module.exports = process.platform === 'win32' ? win : main; | ||
module.exports = isSupported ? main : fallbacks; |
{ | ||
"name": "log-symbols", | ||
"version": "1.0.2", | ||
"description": "Colored symbols for various log levels. Example: ✔︎ success", | ||
"license": "MIT", | ||
"repository": "sindresorhus/log-symbols", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "node test.js" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"unicode", | ||
"cli", | ||
"cmd", | ||
"command-line", | ||
"characters", | ||
"char", | ||
"symbol", | ||
"symbols", | ||
"figure", | ||
"figures", | ||
"fallback", | ||
"win", | ||
"windows", | ||
"log", | ||
"logging", | ||
"terminal", | ||
"stdout" | ||
], | ||
"dependencies": { | ||
"chalk": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "0.0.4" | ||
} | ||
"name": "log-symbols", | ||
"version": "2.0.0", | ||
"description": "Colored symbols for various log levels. Example: ✔︎ Success", | ||
"license": "MIT", | ||
"repository": "sindresorhus/log-symbols", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"browser.js" | ||
], | ||
"keywords": [ | ||
"unicode", | ||
"cli", | ||
"cmd", | ||
"command-line", | ||
"characters", | ||
"char", | ||
"symbol", | ||
"symbols", | ||
"figure", | ||
"figures", | ||
"fallback", | ||
"win", | ||
"windows", | ||
"log", | ||
"logging", | ||
"terminal", | ||
"stdout" | ||
], | ||
"dependencies": { | ||
"chalk": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"strip-ansi": "^4.0.0", | ||
"xo": "*" | ||
}, | ||
"browser": "browser.js" | ||
} |
# log-symbols [![Build Status](https://travis-ci.org/sindresorhus/log-symbols.svg?branch=master)](https://travis-ci.org/sindresorhus/log-symbols) | ||
<img src="screenshot.png" width="226" align="right"> | ||
> Colored symbols for various log levels | ||
Includes fallbacks for Windows CMD which only supports a [limited character set](http://en.wikipedia.org/wiki/Code_page_437). | ||
Includes fallbacks for Windows CMD which only supports a [limited character set](https://en.wikipedia.org/wiki/Code_page_437). | ||
![](screenshot.png) | ||
## Install | ||
```sh | ||
$ npm install --save log-symbols | ||
``` | ||
$ npm install log-symbols | ||
``` | ||
@@ -20,7 +20,7 @@ | ||
```js | ||
var logSymbols = require('log-symbols'); | ||
const logSymbols = require('log-symbols'); | ||
console.log(logSymbols.success, 'finished successfully!'); | ||
// On real OSes: ✔ finished successfully! | ||
// On Windows: √ finished successfully! | ||
console.log(logSymbols.success, 'Finished successfully!'); | ||
// On good OSes: ✔ Finished successfully! | ||
// On Windows: √ Finished successfully! | ||
``` | ||
@@ -38,4 +38,9 @@ | ||
## Related | ||
- [figures](https://github.com/sindresorhus/figures) - Unicode symbols with Windows CMD fallbacks | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3605
5
40
45
3
3
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
Updatedchalk@^2.0.1