Skip to content

Commit c0ee50b

Browse files
Update sync and checksum script (#1000)
1 parent 8ef5170 commit c0ee50b

426 files changed

Lines changed: 4665 additions & 1897 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ npm-debug.log
2727
# Ignore yarn lockfile and error, in case someone accidentally runs yarn
2828
yarn.lock
2929
yarn-error.log
30+
31+
# Script generated files
32+
/exercises/**/*.sha
33+
/exercise-package.json
34+
/exercise-package.json.sha

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"solution": ["%{kebab_slug}.js"],
2020
"test": ["%{kebab_slug}.spec.js"],
2121
"example": [".meta/proof.ci.js"],
22-
"exemplar": [".meta/examplar.js"]
22+
"exemplar": [".meta/exemplar.js"]
2323
},
2424
"exercises": {
2525
"concept": [
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": true,
3+
"parser": "babel-eslint",
4+
"parserOptions": {
5+
"ecmaVersion": 7,
6+
"sourceType": "module"
7+
},
8+
"globals": {
9+
"BigInt": true
10+
},
11+
"env": {
12+
"es6": true,
13+
"node": true,
14+
"jest": true
15+
},
16+
"extends": [
17+
"eslint:recommended",
18+
"plugin:import/errors",
19+
"plugin:import/warnings"
20+
],
21+
"rules": {
22+
"linebreak-style": "off",
23+
24+
"import/extensions": "off",
25+
"import/no-default-export": "off",
26+
"import/no-unresolved": "off",
27+
"import/prefer-default-export": "off"
28+
}
29+
}

exercises/concept/array-loops/.meta/exemplar.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,8 @@ export function cardTypeCheck(stack, card) {
2424
* @returns {number} the number of unique cards there any in the stack
2525
*/
2626
export function determineUniqueCards(stack) {
27-
let counts = {};
28-
29-
stack.forEach((c) => {
30-
if (counts[c.toString()] > 0) {
31-
counts[c.toString()]++;
32-
} else {
33-
counts[c.toString()] = 1;
34-
}
35-
});
36-
37-
let uniques = 0;
38-
39-
Object.keys(counts)
40-
.map((key) => counts[key])
41-
.forEach((v) => v === 0 && uniques++);
42-
43-
return uniques;
27+
return stack.filter((card, index, self) => self.indexOf(card) === index)
28+
.length;
4429
}
4530

4631
/**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
audit=false
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Exercism
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

exercises/concept/array-loops/array-loops.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,30 @@ describe('array-loops', () => {
3030
});
3131
});
3232

33-
describe('uniqueCards', () => {
33+
describe('oddEvenCards', () => {
3434
/** @type {Array<Array<Array<number>, boolean, number>>>} */
3535
const oddEvenCardsTestCases = [
3636
[[1, 2, 3], true, 1],
37-
[[1, 2, 3, -1, 32, 1, 2, 3], false, 2],
37+
[[1, 2, 3, -1, 32, 1, 2, 3], false, 4],
3838
];
3939

4040
oddEvenCardsTestCases.forEach(([array, isEven, expected]) => {
41-
test(`oddEvenCards([${array}], isEven)`, () => {
42-
expect(oddEvenCards(array, isEven)).toBe(expected);
41+
test(`determineOddEvenCards([${array}], isEven)`, () => {
42+
expect(determineOddEvenCards(array, isEven)).toBe(expected);
4343
});
4444
});
4545
});
4646

47-
describe('oddEvenCards', () => {
47+
describe('uniqueCards', () => {
4848
/** @type {Array<Array} */
4949
const uniqueCardTestCases = [
50-
[[1, 2, 3], true, 3],
51-
[[1, 2, 3, -1, 32, 1, 2, 3], 2],
50+
[[1, 2, 3], 3],
51+
[[1, 2, 3, -1, 32, 1, 2, 3], 5],
5252
];
5353

5454
uniqueCardTestCases.forEach(([array, expected]) => {
55-
test(`uniqueCards([${array}])`, () => {
56-
expect(uniqueCards(array)).toBe(expected);
55+
test(`determineUniqueCards([${array}])`, () => {
56+
expect(determineUniqueCards(array)).toBe(expected);
5757
});
5858
});
5959
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
targets: {
7+
node: 'current',
8+
},
9+
useBuiltIns: 'entry',
10+
corejs: 3,
11+
},
12+
],
13+
],
14+
plugins: ['@babel/plugin-syntax-bigint'],
15+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@exercism/javascript-concept-array-loops",
3+
"description": "Exercism concept exercise on array-loops",
4+
"author": "Derk-Jan Karrenbeld <derk-jan+github@karrenbeld.info>",
5+
"private": true,
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/exercism/javascript"
9+
},
10+
"devDependencies": {
11+
"@babel/cli": "^7.13.0",
12+
"@babel/core": "^7.13.1",
13+
"@babel/plugin-syntax-bigint": "^7.8.3",
14+
"@babel/preset-env": "^7.13.5",
15+
"@types/jest": "^26.0.20",
16+
"@types/node": "^14.14.31",
17+
"babel-eslint": "^10.1.0",
18+
"babel-jest": "^26.6.3",
19+
"core-js": "^3.9.0",
20+
"eslint": "^7.20.0",
21+
"eslint-plugin-import": "^2.22.1",
22+
"jest": "^26.6.3"
23+
},
24+
"scripts": {
25+
"test": "jest --no-cache ./*",
26+
"watch": "jest --no-cache --watch ./*",
27+
"lint": "eslint ."
28+
},
29+
"license": "MIT",
30+
"dependencies": {}
31+
}

exercises/concept/basics/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"ecmaVersion": 7,
66
"sourceType": "module"
77
},
8+
"globals": {
9+
"BigInt": true
10+
},
811
"env": {
912
"es6": true,
1013
"node": true,

0 commit comments

Comments
 (0)