Dart base 56 library for converting base10 (and base 8) numbers to / from base 56 for use as small, readable and usually HTML-ID safe sequences.
Base 56 is arbitrary, as the character set can be shrunk or expanded in the library as a configuration setting, but Base56 is handy because it uses just letters and numbers while excluding OILoil from the set which can be mistaken for zeros and ones.
dart pub get
import 'lib/bX.dart';
void main() {
final bxValue = "z";
// the return value is a list with one or more lists that contain 0 or 1 ints
final b10Value = B10.convertBxToB10(bxValue);
print(b10Value[0][0]); // Outputs: 55
final bxValueBack = B10.convertB10ToBx(b10Value);
print(bxValue); // Outputs: z
}
Tests are located in the test
directory and follow the naming convention *_test.dart
.
Run all tests:
dart test
Run a specific test file:
dart test test/bx_test.dart
Run tests with coverage:
dart test --coverage=coverage
dart run coverage:format_coverage --lcov --in=coverage --out=coverage.lcov --packages=.packages --report-on=lib
- Fork the repository
- Create your feature branch
- Add tests for any new functionality
- Ensure all tests pass
- Submit a pull request