draw-box

1.0.0 • Public • Published
  │         │                       
  │         │ │          │          
  │         │ │     │    │          
  │         └─┼─────┼─┐  │        │ 
  └──────────┼┴─┼───┼─┼──┼────┬───┴─
             │  │   └┬───┴────┼┐    
   ┌───────┬─┴─┴┴────┼────┐   ││    
           │         │         │    
                               │              

This is tiny, zero-dependency library for merging special characters, based on the official UTF8 tables. This library is mainly useful for overlapping some text on other text, while preserving as much visual information as possible.

const { mergeChar } = require('merge-char')
 
mergeChar('', '') // results in ┴
 
mergeChar('a', 'b') // not mergable: will return null

Limitations

Currently the only characters that are supported are a subset of the UTF8 box drawing characters. Feel free to open a pull request if you'd like to see some other characters supported.

API

isMergable(char)

Checks if given character is mergable with other characters, based on the merging tables.

mergeChars(...chars)

Merges the given characters, returning the merged character is one is found. In case of failure, null is returned.

Package Sidebar

Install

npm i draw-box

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • samvv