Skip to content

Commit

Permalink
Implement translator
Browse files Browse the repository at this point in the history
  • Loading branch information
piecioshka committed Oct 17, 2017
1 parent 7758dfc commit 9f966f8
Show file tree
Hide file tree
Showing 10 changed files with 1,069 additions and 304 deletions.
21 changes: 21 additions & 0 deletions .bin/cli.js
@@ -0,0 +1,21 @@
#!/usr/bin/env node

'use strict';

var translator = require('../src/index');
var version = require('../package.json').version;
var program = require('commander');

program
.version(version)
.arguments('<number>')
.action(function (phoneNumber) {
let translatedNumber = translator.translate(phoneNumber);
console.log(translatedNumber);
})
.parse(process.argv);

// In default mode, display help.
if (process.argv.length <= 2) {
program.help();
}
8 changes: 5 additions & 3 deletions .eslintrc.js
Expand Up @@ -5,15 +5,17 @@ module.exports = {
env: {
es6: true,
// browser: true,
// node: true,
// commonjs: true,
node: true,
commonjs: true,
// amd: true,
// jquery: true,
jasmine: true
},

// http://eslint.org/docs/rules/
rules: {},
rules: {
'no-implicit-globals': ['off']
},

// List of global variables.
globals: {}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,3 @@ node_modules/
npm-debug.log

coverage/
dist/
4 changes: 4 additions & 0 deletions .travis.yml
@@ -0,0 +1,4 @@
language: node_js
node_js:
- "8"
- "7"
53 changes: 51 additions & 2 deletions README.md
@@ -1,6 +1,55 @@
# mobile-keyboard-translator
# mobile-keyboard-translator ([npm](https://www.npmjs.com/package/mobile-keyboard-translator))

> TODO
[![npm version](https://badge.fury.io/js/mobile-keyboard-translator.svg)](https://badge.fury.io/js/mobile-keyboard-translator)
![](https://img.shields.io/npm/dt/mobile-keyboard-translator.svg)
[![Travis](https://img.shields.io/travis/piecioshka/mobile-keyboard-translator.svg?maxAge=2592000)](https://travis-ci.org/piecioshka/mobile-keyboard-translator)
[![Coverage Status](https://coveralls.io/repos/github/piecioshka/mobile-keyboard-translator/badge.svg?branch=master)](https://coveralls.io/github/piecioshka/mobile-keyboard-translator?branch=master)

> :hammer: Translate phone number with letters to only with numbers
## Usage

```
$ npm install mobile-keyboard-translator
$ mobile-keyboard-translator 1-800-FLOWERS
1-800-3569377
```

## Help

```
$ mobile-keyboard-translator -h
Usage: mobile-keyboard-translator [options] <number>
Options:
-V, --version output the version number
-h, --help output usage information
```

## Purpose

This is mobile keyboard:

-------------------
| 1 | 2 | 3 |
| | ABC | DEF |
-------------------
| 4 | 5 | 6 |
| GHI | JKL | MNO |
-------------------
| 7 | 8 | 9 |
| PQRS| TUV | WXYZ|
-------------------
| * | 0 | # |
| | | |
-------------------

Credits: https://rebased.pl/akademia.html

Tool converts ex. `1-800-FLOWERS` to `1-800-3569377`.

## Unit tests

Expand Down
10 changes: 0 additions & 10 deletions index.html

This file was deleted.

0 comments on commit 9f966f8

Please sign in to comment.