Skip to content

Commit

Permalink
Merge branch 'master' into fix-typo
Browse files Browse the repository at this point in the history
  • Loading branch information
romacher authored Oct 12, 2019
2 parents 6063fa5 + af8b7ad commit 9afa2c5
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 30 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Write your solution in `src/index.js`

---

**Input:** String of `0` and `1`. Its length is multiple of 10.
- Each letter from alphabet encoded with dots(`.`) and dashes(`-`). `10` stands for dot(`.`), `11` stands for dash(`-`).
**Input:** String. Its length is multiple of 10.
- Each letter from alphabet encoded with dots(`.`) and dashes(`-`). `10` stands for dot(`.`), `11` stands for dash(`-`).
- Each encoded **letter's length is 10**.
- If length of encoded letter is **less than 10**, it must be `left padded` with `0`.
- `Space` in a input string is encoded with ten asterisks ->`**********`.
- **Example:** `me` -> `--` `.` -> `0000001111 0000000010`. Spaces in final result were added for the sake of concept better understanding. Input string does **NOT** include spaces.
**Output:** String (decoded). Simply put, `00000011110000000010` should be decoded by your application as `me`.
- If the length of the encoded letter is **less then 10**, it `left padded` with `0`.
- `Space` in string is `**********`.
**Output:** String (decoded)
**Example:** `me` -> `m === -- === 0000001111`, `e === . === 0000000010` -> `00000011110000000010`

---

Expand All @@ -30,4 +30,8 @@ Write your solution in `src/index.js`
1. Open [rs app](https://app.rs.school) and login
2. Go to [submit task page](https://app.rs.school/course/submit-task?course=rs-2019-q3)
3. Select your task (morse-decoder)
4. Press the submit button and enjoy
4. Press the submit button and enjoy

### Notes
1. We recommend you to use nodejs of version 10 or lower. If you using any of features that does not supported by node v10, score won't be submitted.
2. Please be sure that each of your test in limit of 30sec.
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"description": "Morse code decoder",
"main": "test.js",
"scripts": {
"test": "mocha test.js"
"test": "mocha test.js",
"postinstall": "node postinstall.js"
},
"engines": {
"node": "<=10"
},
"repository": {
"type": "git",
Expand All @@ -19,5 +23,9 @@
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^6.2.0"
},
"dependencies": {
"colors": "^1.4.0",
"semver": "^6.3.0"
}
}
13 changes: 13 additions & 0 deletions postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const semver = require('semver');
const colors = require('colors/safe');

const { engines: { node: nodeVersion }} = require('./package');

if (!semver.satisfies(process.version, nodeVersion)) {
process.emitWarning(
colors.red(`
For this task we are strictly recomend you to use node ${nodeVersion}.
Now you are using node ${process.version}, if you are using any of features that not supported by node ${nodeVersion}, score won't be submitted
`)
);
}
Loading

0 comments on commit 9afa2c5

Please sign in to comment.