Convert between numbers of different bases. ๐ฎ ๐ธ
Roughly a year ago, I set myself the challenge of implementing a set of functions that could convert between numbers of different bases. I implemented this in Dart and decided to re-write this implementation in Javascript. The Dart implementation can be found here. The bases this library handles are: base 10, base 2, and base 16.
Zeppo offers the following functions:
letterIndex(letter)
: Gets the index of a letter in the alphabet. Returns zero if the letter isn't in the alphabet.getLetterFromIndex(index)
: Gets the letter from a supplied index. Returns an empty string if a letter cannot be found.binToDec(binaryNumber)
: Converts a base 2 number to a base 10 number.decToBin(decimalNumber)
: Converts a base 10 number to a base 2 number.hexToDec(hexNumber)
: Converts a base 16 number to a base 10 number.isBin(expr)
: Checks whether the supplied string is a binary number or not.isInt(expr)
: Checks whether the supplied string is an integer or not.isHex(expr)
: Checks whether the supplied string is a hexadecimal number or not.
-
1.) Create a Typescript file.
-
2.) To use Zeppo in a Deno project, add this line of code to your Typescript file(s) (
functionName
represents any of the function signatures above.):
import { functionName } from 'https://deno.land/x/zeppo/mod.ts';
-
3.) You can now use any of the function signatures above.
-
4.) You can run the Typescript file with Deno using this command (
your_script.ts
represents your Typescript file.):
deno run your_script.ts
- Initial release.
- Upload to GitHub.
- Upload to NPM.
- New license file.
- Better documentation.
- Updated documentation.
- Added a function to check whether a string is a binary number or not.
- Updated documentation.
- Added a function to check whether a string is an integer or not.
- Updated documentation.
- Updated, published, and uploaded under my new name.
- Fixed some administrative issues.
- Fixed some formatting issues.
- Updated
export
statement. - Updated documentation for Typescript.
- Added support for Deno.
- Removed the
reverseArray
function. - Removed the
testAll
function. - Added unit tests with Deno.
- Added a function to check whether a string is a hexadecimal number or not.
- Rewrote the project in Typescript.
- Migrated this project from Node.js to Deno.
- Relicensed the project under the DSL v1.
- Zeppo ๐ฎ ๐ธ by Alexander Abraham ๐ค a.k.a. "Angel Dollface" ๐ ๐
- Licensed under the DSL v1.