Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsilvermist/base-converter
A web-component to use with data binding for converting or checking the base of a number.
https://github.com/jsilvermist/base-converter
base-conversion polymer web-component
Last synced: about 1 month ago
JSON representation
A web-component to use with data binding for converting or checking the base of a number.
- Host: GitHub
- URL: https://github.com/jsilvermist/base-converter
- Owner: jsilvermist
- License: mit
- Created: 2016-02-06T13:41:32.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-23T03:03:39.000Z (over 8 years ago)
- Last Synced: 2024-11-09T23:07:00.288Z (3 months ago)
- Topics: base-conversion, polymer, web-component
- Language: HTML
- Size: 1.71 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# base-converter
An element to use with data binding for converting or checking the base of a number.
Convert any number up to 2^53 (9,007,199,254,740,991),
to or from any base from base 2 to base 36.### Demo
For demos and documentation visit the [base-converter GitHub.io Page](http://jsilvermist.github.io/base-converter/components/base-converter/).
### Examples
Conversion Example:
```html
Number: ff; From: 16; To: 10
The result is: {{result}}
```
Checking Example:
```html
Number: 92; Base: 8
The number is a valid base 8 number: {{isValid}}
```
> Note: Conversion and checking can be used both together or separetely.
To use the values inside of JavaScript but outside of a Polymer element,
add an ID to your template and select it, then access the data-bindings.```html
document.addEventListener('WebComponentsReady', function() {
var app = document.querySelector('#app');
console.log('JavaScript: The result is ' + app.converted);
});```
## How To Use
### Installation
The best way to install this element is through [Bower](http://bower.io/).
If you don't already have bower installed, install [Node.js](nodejs.org),
open a terminal window and type:```sh
npm install -g bower
```Once you have bower installed, you may want to use `bower init` to initialize your project.
This will enable you to save packages you install to make it easier to update,
and install all dependencies again later.To install this element, type:
```sh
bower install --save base-converter
```### Using
To use the element after installing it, first load webcomponents polyfill in the head of your page
(Recommended to be loaded at the top before any other scripts):```html
```
Second, import the element before using it (this can be in the head or wherever you wish):
```html
```
Ensure that the path to bower_components is correct if it's not in the same directory.
## Playing With The Element
If you wish to work on the element in isolation, we recommend that you use
[Polyserve](https://github.com/PolymerLabs/polyserve) to keep the element's
bower dependencies in line. You can install it via:```sh
npm install -g polyserve
```And you can run it via:
```sh
polyserve
```Once running, you can preview the element at
`http://localhost:8080/components/base-converter/`, where `base-converter` is the name of the directory containing it.### Dependencies
Element dependencies are managed via [Bower](http://bower.io/). You can
install all of the element's dependencies via:```sh
bower install
```