Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 16, 2020
1 parent f1ad9fe commit 3ae05ee
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 82 deletions.
18 changes: 11 additions & 7 deletions index.d.ts
Expand Up @@ -62,7 +62,7 @@ type FigureSet = typeof figureSet

declare const figures: {
/**
Replace unicode symbols depending on the OS.
Replace Unicode symbols depending on the OS.
@param string - String where the Unicode symbols will be replaced with fallback symbols depending on the OS.
@returns The input with replaced fallback Unicode symbols on Windows.
Expand All @@ -72,20 +72,24 @@ declare const figures: {
import figures = require('figures');
console.log(figures('✔︎ check'));
// On real OSes: ✔︎ check
// On Windows: √ check
// On non-Windows OSes: ✔︎ check
// On Windows: √ check
console.log(figures.tick);
// On real OSes: ✔︎
// On Windows: √
// On non-Windows OSes: ✔︎
// On Windows:
```
*/
(string: string): string;

/** Figures to use when not running on Windows. */
/**
Symbols to use when not running on Windows.
*/
readonly main: FigureSet;

/** Figures to use when running on Windows. */
/**
Symbols to use when running on Windows.
*/
readonly windows: FigureSet;
} & FigureSet;

Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -124,7 +124,7 @@ const windows = {
};

if (platform === 'linux') {
// The main one doesn't look that good on Ubuntu
// The main one doesn't look that good on Ubuntu.
main.questionMarkPrefix = '?';
}

Expand Down
2 changes: 1 addition & 1 deletion license
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion makefile.js
Expand Up @@ -9,7 +9,7 @@ const data = Object.entries(darwin).map(([name, figure]) => [name, figure, win32
const jsonTable = [
[
'Name',
'Real OSes',
'Non-Windows',
'Windows'
],
...data
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -4,10 +4,11 @@
"description": "Unicode symbols with Windows CMD fallbacks",
"license": "MIT",
"repository": "sindresorhus/figures",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
Expand Down
136 changes: 65 additions & 71 deletions readme.md
Expand Up @@ -8,14 +8,12 @@

Windows CMD only supports a [limited character set](http://en.wikipedia.org/wiki/Code_page_437).


## Install

```
$ npm install figures
```


## Usage

See the [source](index.js) for supported symbols.
Expand All @@ -24,12 +22,12 @@ See the [source](index.js) for supported symbols.
const figures = require('figures');

console.log(figures('✔︎ check'));
// On real OSes: ✔︎ check
// On Windows: √ check
// On non-Windows OSes: ✔︎ check
// On Windows: √ check

console.log(figures.tick);
// On real OSes: ✔︎
// On Windows: √
// On non-Windows OSes: ✔︎
// On Windows:

console.log(figures.main.tick);
// On all OSes: ✔︎
Expand All @@ -38,7 +36,6 @@ console.log(figures.windows.tick);
// On all OSes: √
```


## API

### figures(string)
Expand All @@ -53,85 +50,82 @@ Type: `string`

String where the Unicode symbols will be replaced with fallback symbols depending on the OS.


### figures.main

Figures to use when not running on Windows.

Symbols to use when not running on Windows.

### figures.windows

Figures to use when running on Windows.
Symbols to use when running on Windows.


## Figures

| Name | Real OSes | Windows |
| ------------------ | :-------: | :-----: |
| tick | ||
| cross | | × |
| star | | * |
| square | ||
| squareSmall | | [ ] |
| squareSmallFilled | | [] |
| play | ||
| circle | | ( ) |
| circleFilled | | (*) |
| circleDotted | | ( ) |
| circleDouble | | ( ) |
| circleCircle | | (○) |
| circleCross | | (×) |
| circlePipe | | (│) |
| circleQuestionMark | ?⃝ | (?) |
| bullet | | * |
| dot | | . |
| line | ||
| ellipsis | | ... |
| pointer | | > |
| pointerSmall | | » |
| info | | i |
| warning | ||
| hamburger | ||
| smiley | ||
| mustache | | ┌─┐ |
| heart | ||
| nodejs | ||
| arrowUp | ||
| arrowDown | ||
| arrowLeft | ||
| arrowRight | ||
| radioOn | | (*) |
| radioOff | | ( ) |
| checkboxOn | | [×] |
| checkboxOff | | [ ] |
| checkboxCircleOn | | (×) |
| checkboxCircleOff | | ( ) |
| questionMarkPrefix | ?⃝ ||
| oneHalf | ½ | 1/2 |
| oneThird | | 1/3 |
| oneQuarter | ¼ | 1/4 |
| oneFifth | | 1/5 |
| oneSixth | | 1/6 |
| oneSeventh | | 1/7 |
| oneEighth | | 1/8 |
| oneNinth | | 1/9 |
| oneTenth | | 1/10 |
| twoThirds | | 2/3 |
| twoFifths | | 2/5 |
| threeQuarters | ¾ | 3/4 |
| threeFifths | | 3/5 |
| threeEighths | | 3/8 |
| fourFifths | | 4/5 |
| fiveSixths | | 5/6 |
| fiveEighths | | 5/8 |
| sevenEighths | | 7/8 |
| Name | Non-Windows | Windows |
| ------------------ | :---------: | :-----: |
| tick | ||
| cross | | × |
| star | | * |
| square | ||
| squareSmall | | [ ] |
| squareSmallFilled | | [] |
| play | ||
| circle | | ( ) |
| circleFilled | | (*) |
| circleDotted | | ( ) |
| circleDouble | | ( ) |
| circleCircle | | (○) |
| circleCross | | (×) |
| circlePipe | | (│) |
| circleQuestionMark | ?⃝ | (?) |
| bullet | | * |
| dot | | . |
| line | ||
| ellipsis | | ... |
| pointer | | > |
| pointerSmall | | » |
| info | | i |
| warning | ||
| hamburger | ||
| smiley | ||
| mustache | | ┌─┐ |
| heart | ||
| nodejs | ||
| arrowUp | ||
| arrowDown | ||
| arrowLeft | ||
| arrowRight | ||
| radioOn | | (*) |
| radioOff | | ( ) |
| checkboxOn | | [×] |
| checkboxOff | | [ ] |
| checkboxCircleOn | | (×) |
| checkboxCircleOff | | ( ) |
| questionMarkPrefix | ?⃝ ||
| oneHalf | ½ | 1/2 |
| oneThird | | 1/3 |
| oneQuarter | ¼ | 1/4 |
| oneFifth | | 1/5 |
| oneSixth | | 1/6 |
| oneSeventh | | 1/7 |
| oneEighth | | 1/8 |
| oneNinth | | 1/9 |
| oneTenth | | 1/10 |
| twoThirds | | 2/3 |
| twoFifths | | 2/5 |
| threeQuarters | ¾ | 3/4 |
| threeFifths | | 3/5 |
| threeEighths | | 3/8 |
| fourFifths | | 4/5 |
| fiveSixths | | 5/6 |
| fiveEighths | | 5/8 |
| sevenEighths | | 7/8 |


## Related

- [log-symbols](https://github.com/sindresorhus/log-symbols) - Colored symbols for various log levels


---

<div align="center">
Expand Down

0 comments on commit 3ae05ee

Please sign in to comment.