diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index def73e60..e8063274 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [14.x] steps: - uses: actions/checkout@v2 diff --git a/package.json b/package.json index d040afd3..e0a28a82 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "license": "GPL-3.0", "devDependencies": { "@mate-academy/eslint-config": "*", - "@mate-academy/scripts": "^0.3.5", + "@mate-academy/scripts": "^1.2.12", "eslint": "^5.16.0", "eslint-plugin-jest": "^22.4.1", "eslint-plugin-node": "^8.0.1", diff --git a/src/inverseRobot.js b/src/inverseRobot.js index 4906e020..5d109a7c 100644 --- a/src/inverseRobot.js +++ b/src/inverseRobot.js @@ -7,7 +7,19 @@ */ function inverseRobot(robot) { - // write code here + const reversed = {}; + + for (const key in robot) { + const value = robot[key]; + + if (reversed.hasOwnProperty(value)) { + return null; + } + + reversed[value] = key; + } + + return reversed; } module.exports = inverseRobot;