rotate-char

1.0.0 • Public • Published
├ ┬ ┤ ┴ ├

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.

Package Sidebar

Install

npm i rotate-char

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • samvv