rotate-char
v1.0.0
Published
An utility library for rotating UTF8 characters
Downloads
1
Maintainers
Readme
├ ┬ ┤ ┴ ├
This is tiny, zero-dependency library for rotating special characters, based on the official UTF8 tables.
const { rotateChar } = require('rotate-char')
rotateChar('└', -Math.PI/2) // results in ┘
rotateChar('⚠', Math.PI) // not rotatable: will return the original character
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
canRotate(char)
Checks if given character can be rotated using this library.
rotateChar(char, rad)
Finds the character that comes nearest to the rotation of the original character given in radians. If no matching rotation is found, the original character is returned.