/base

Base conversion CLI and API,using either a JS implementation or a C++ implementation.

Primary LanguageJavaScriptMIT LicenseMIT

Base

Base conversion CLI and API, using either a JS or a C++ implementation.

Inline docs Build Status Coverage Status Dependency Status Development Dependency Status


Dependencies

Install

  1. Clone source
  2. npm install
  3. To use C++ implementations: npm run build

Usage

CLI

$ base from to data implementation

from and to are bases to convert between, input is the data to convert and implementation is a known implementation (js, cpp). from, to and data are required. implementation is optional, defaults to cpp.

Example:

$ base 2 10 "0101001101010101" js

In a Node.js project

base = require('base')

API

base.api(from, to, input, implementation)

from and to are bases to convert between, input is the data to convert and implementation is a known implementation (js, cpp). from, to and data are required. implementation is optional, defaults to cpp.

Example:

base.api(10, 16, 255, 'js')

Raw

base[from][implementation][to](input)

from and to are bases to convert between, input is the data to convert and implementation is a known implementation (js, cpp).

Example:

base[10]['cpp'][16](255)

Tests and coverage information

 npm run local_test