2.0.2 • Published 2 years ago

@thebespokepixel/string v2.0.2

Weekly downloads
45
License
MIT
Repository
github
Last release
2 years ago

@thebespokepixel/string

A collection of enhanced formats and utilities for strings.

Publishing Status

npm Libraries.io
Travis Rollup

Development Status

Travis Libraries.io
Snyk Code-Climate Code-Climate Coverage

Documentation/Help

Inch.io Twitter

Usage

Installation

npm install --save @thebespokepixel/string

Example

const bString = require('@thebespokepixel/string')

console.log(bString.subScript('String to print'))

.pad(string, char, length)

Pads string, using char to length characters. If length is negative, pads the right rather than the left of string. If length is less than string.length, it will crop string to fit.

.toSuperscript(string) | .toSubscript(string)

Prints the string using the alternative super/sub characters available in Unicode (Such as in DejaVu Sans Mono or Source Code Pro). Superscript support is much more complete that Subscript. Unavaiable subscript characters will be printed as . The character Q has to be approximated.

TODO: Use compound Unicode overlay characters to better approximate missing chars.

Unless the environment has TERM_FONT=full set (see Term-NG) and you have a Unicode terminal font that supports sub/super-script characters, then it will fall back to printing normal characters.

Character set (Github display is incomplete)
ClassNumeralsSymbolsLower caseUpper case
Basic0123456789+-=:()/|.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
Superscript⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁼⁽⁾╵╵⋅ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖᵍʳˢᵗᵘᵛʷˣʸᶻᴬᴮᶜᴰᴱᶠᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴼᴿˢᵀᵁⱽᵂˣʸᶻ
Subscript₀₁₂₃₄₅₆₇₈₉₊₋₌₌₍₎╷╷.ₐₓₓₓₑₓₓₕᵢⱼₖₗₘₙₒₚₓᵣₛₜᵤᵥₓₓₓₓᴀʙcᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ

Documentation

Full documentation can be found at https://thebespokepixel.github.io/string/

2.0.2

2 years ago

2.0.1

2 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.5.10

5 years ago

0.5.9

5 years ago

0.5.8

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.4.0-beta.0

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.2.0-0

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago