Master Branch :
This Library converts numbers to printable digit styled strings.
In this library you can find the some classes and interfaces to simply create a nummerical digit display in console.
Eg. If you want to display a temperature more styled in the console.
___________________________
| _ _ _ _ |
| | _| _||_| |_| | |
| ||_ / _| | |_ |
|___________________________|
For now, this is not fully integrated in the package, but this will be added soon.
You can find next listed classes /interfaces :
Converts single numbers to instances of the Digit interface.
Converts full numbers to instances of the Digit interface.
Converts single characters (one char strings) to instances of the Digit interface.
Converts full string to instances of the Digit interface.
!Attention : The methods in this class converts only known characters and numbers. See table below.
You can access the single digits also by importing following chars/numbers :
existing characters | Digit const | Description |
---|---|---|
0, 1, 2,... -9 (also in string '0') | ZERO , ONE ,TWO ,... |
By importing this const you have the instance of the digit interface class for this number. |
- | MINUS |
By importing this const you have the instance of the digit interface class for the minus char. Attention, this character can only give with a number or only as character. |
. | COMMA |
When using full numbers with comma seperated values The same applies as with MINUS |
° | DEGREE |
This character can be used to display a temperature unit. Attention, this can only be used in character or string methods |
C | CHAR_C |
This character can also be used to display a temperature unit. I choose this notation instead of using Celcius , so that when I later decide to fully implement the class with all existing characters, I can still do that. The same is true as DEGREE |
These Characters can also be found in the existingDigitCharacters.ts file.
This interface represents an LED Digit Display. Each Digit consists of 7 controllable segments. (a,b,c,d,e,f,g)
This is represented in an object on the had of the corresponding letters.
{
a: false,
b: false,
c: true,
d: true,
e: true,
f: true,
g: true
}
With this class you can print all exisiting characters. (See DigitConverterClass)
_ _ _ _ _ _ _ _ _ _
_ | | | _| _| |_| |_ |_ | |_| |_| |_| |
|_| / | |_ _| | _| |_| | |_| _| |_
toString(digit: Digit[])
method :toStringDigits(string: String)
method :printDigits(digit: Digit[])
method :printStringAsDigits(string: String)
method :In version v0.3.2 the framework function was added. With this function you can build a framework around the digit styled numbers.
Eg. :
_____________________________________
| _ _ _ _ _ _ |
| _ _| | | _| | | |_| | |
| |_ |_| / |_ |_| |_ |
|_____________________________________|
In version v0.3.3 the large Digits function was added. With this function you can build double sized digits.
___________________________________________________________________________________________
| ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ |
| | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | |
| ___ ___ ___ ___ ___ ___ ___ ___ ___ |
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | |
| ___ / ___ ___ ___ ___ ___ ___ ___ |
|___________________________________________________________________________________________|
This class has the same functionality as the print digit class. But know you can also insert temperatures and log them into the console.
This class adds a few more methods to set, get and prints the temperature as digits. Also in this class the framework and the large letters works.
Make sure youre project is already an npm project:
npm init
To pull this project from npm you can use the next command :
npm i @geylianlingier/digit-style
Update package :
npm install
Running eslinter :
npm run lint
Create/update documentation :
npm run docs
Set up project :
install all necessary libraries
adding index.ts file with hello world console.log
Added the Digit Converter class to the project
With this class you can convert numbers and string to digits with the existing digit numbers and characters.
In this version, I added more documentation about the Digit Converter class.
Because all of the numbers/characters are in the same document as the convertDigit class. I decide to seperate all the numbers/characters in a seperated file.
add documentation for publishing to npm.
Go to npm package...
In this version the package will be published for the first time on npm.
In this version I added the printDigit class. This class prints out the digits styled numbers and characters.
Solve Bug in exisiting digits.
Add more methods to simplify usage of the print class. Know you should not use the digit converter separately to complete the print class.
-> implementation digitConverter in printDigits.
Add framework function to the print digit class. It shows a Framework around the digits.
You can simply enable the framework function in the constructor. ( default value is false)
Or via the 3 new added method :
setFramework(framework: boolean)
: set the framework true
or false
enableFramework()
: enables Framework
disableFramework()
: disables Framework
Extra : better styled chars
Add large digit function to the print class, so it can shows the digits in double size.
You can again simply enable largeLetters, just like you can enable and disable the framework.
Add a new class with the same functionality as the print digit class. But know you can also insert temperatures and log them into the console.
This class adds a few more methods to set, get and prints the temperature as digits. Also in this class the framework and the large letters works.
install eslint and solve linter errors
This Library is licenced with MIT. More Information
I am Geylian, student Electronics-ICT in university Vives in Bruges. I create this library for an exam exercise for school.
For more projects like this check my Github :octocat:
Generated using TypeDoc