Feat: add new Markdown parser (#39800)

and change all the challenges to new `md` format.
This commit is contained in:
Oliver Eyton-Williams
2020-11-27 19:02:05 +01:00
committed by GitHub
parent a07f84c8ec
commit 0bd52f8bd1
2580 changed files with 113436 additions and 111979 deletions

View File

@ -1,65 +1,67 @@
---
title: Hash from two arrays
id: 595671d4d2cdc305f0d5b36f
title: Hash from two arrays
challengeType: 5
forumTopicId: 302283
---
## Description
<section id='description'>
# --description--
Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values).
<strong>Related task:</strong>
**Related task:**
<ul>
<li><a href="https://rosettacode.org/wiki/Associative arrays/Creation" title="Associative arrays/Creation" target="_blank">Associative arrays/Creation</a></li>
<li><a href='https://rosettacode.org/wiki/Associative arrays/Creation' title='Associative arrays/Creation' target='_blank'>Associative arrays/Creation</a></li>
</ul>
</section>
## Instructions
<section id='instructions'>
# --hints--
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>arrToObj</code> should be a function.
testString: assert(typeof arrToObj === 'function');
- text: '<code>arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])</code> should return <code>{ 1: "a", 2: "b", 3: "c", 4: "d", 5: "e" }</code>'
testString: assert.deepEqual(arrToObj(...testCases[0]), res[0]);
- text: '<code>arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d"])</code> should return <code>{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }</code>'
testString: assert.deepEqual(arrToObj(...testCases[1]), res[1]);
- text: '<code>arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])</code> should return <code>{ 1: "a", 2: "b", 3: "c" }</code>'
testString: assert.deepEqual(arrToObj(...testCases[2]), res[2]);
- text: '<code>arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])</code> should return <code>{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }</code>'
testString: assert.deepEqual(arrToObj(...testCases[3]), res[3]);
- text: '<code>arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])</code> should return <code>{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }</code>'
testString: assert.deepEqual(arrToObj(...testCases[4]), res[4]);
- text: '<code>arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])</code> should return <code>{ "a": 1, "b": 2, "c": 3 }</code>'
testString: assert.deepEqual(arrToObj(...testCases[5]), res[5]);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
`arrToObj` should be a function.
```js
function arrToObj (keys, vals) {
return true;
}
assert(typeof arrToObj === 'function');
```
</div>
`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])` should return `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: "e" }`
```js
assert.deepEqual(arrToObj(...testCases[0]), res[0]);
```
### After Test
<div id='js-teardown'>
`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d"])` should return `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }`
```js
assert.deepEqual(arrToObj(...testCases[1]), res[1]);
```
`arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])` should return `{ 1: "a", 2: "b", 3: "c" }`
```js
assert.deepEqual(arrToObj(...testCases[2]), res[2]);
```
`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])` should return `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }`
```js
assert.deepEqual(arrToObj(...testCases[3]), res[3]);
```
`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])` should return `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }`
```js
assert.deepEqual(arrToObj(...testCases[4]), res[4]);
```
`arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])` should return `{ "a": 1, "b": 2, "c": 3 }`
```js
assert.deepEqual(arrToObj(...testCases[5]), res[5]);
```
# --seed--
## --after-user-code--
```js
const testCases = [
@ -81,13 +83,16 @@ const res = [
];
```
</div>
## --seed-contents--
</section>
```js
function arrToObj (keys, vals) {
## Solution
<section id='solution'>
return true;
}
```
# --solutions--
```js
function arrToObj (keys, vals) {
@ -97,5 +102,3 @@ function arrToObj (keys, vals) {
}, {});
}
```
</section>