Skip to content

Commit 1efb508

Browse files
Merge pull request #63 from sandstreamdev/add_missing_examples_for_existing_modules
Add missing examples and questions
2 parents 3358492 + 882412f commit 1efb508

File tree

401 files changed

+8279
-709
lines changed

Some content is hidden

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

401 files changed

+8279
-709
lines changed

README.md

Lines changed: 2449 additions & 119 deletions
Large diffs are not rendered by default.

array/README.md

Lines changed: 731 additions & 24 deletions
Large diffs are not rendered by default.

array/any.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"examples": [
66
{
77
"language": "javascript",
8-
"content": "any([]); // ⇒ false"
8+
"content": "any([]);\n// ⇒ false"
99
},
1010
{
1111
"language": "javascript",
12-
"content": "any([1, 2, 3]); // ⇒ true"
12+
"content": "any([1, 2, 3]);\n// ⇒ true"
1313
}
1414
],
1515
"questions": [
16-
"How to check if an array is empty (in JavaScript)?",
17-
"How to check if array is empty or null or undefined (in JavaScript)?",
18-
"Check if an array is empty or not (in JavaScript).",
19-
"Check if an array is empty or exists (in JavaScript)."
16+
"How to check if an array is empty?",
17+
"How to check if an array is empty or null or undefined?",
18+
"How to check if an array is empty or not?",
19+
"How to check if an array is empty or doesn't exist?"
2020
]
2121
}

array/any.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ Checks if the given array is present and it is not empty (contains at least one
1414

1515
<!-- prettier-ignore-start -->
1616
```javascript
17-
any([]); // ⇒ false
17+
any([]);
18+
// ⇒ false
1819
```
1920

2021
```javascript
21-
any([1, 2, 3]); // ⇒ true
22+
any([1, 2, 3]);
23+
// ⇒ true
2224
```
2325
<!-- prettier-ignore-end -->
2426

2527
## Questions
2628

27-
- How to check if an array is empty (in JavaScript)?
28-
- How to check if array is empty or null or undefined (in JavaScript)?
29-
- Check if an array is empty or not (in JavaScript).
30-
- Check if an array is empty or exists (in JavaScript).
29+
- How to check if an array is empty?
30+
- How to check if an array is empty or null or undefined?
31+
- How to check if an array is empty or not?
32+
- How to check if an array is empty or doesn't exist?

array/are.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
{
22
"name": "are",
3-
"description": "Checks if given arguments are all `Arrays`.",
3+
"description": "Checks if the given arguments are all `Arrays`.",
44
"signature": "(...xs: any[]) => boolean",
55
"examples": [
66
{
77
"language": "javascript",
8-
"content": "are(); // ⇒ TODO"
8+
"content": "are([2, 3]);\n// ⇒ true"
9+
},
10+
{
11+
"language": "javascript",
12+
"content": "are([1, 2, 3], []);\n// ⇒ true"
13+
},
14+
{
15+
"language": "javascript",
16+
"content": "are([1, 2, 3], 8, [1, 3], \"test\");\n// ⇒ false"
917
}
1018
],
11-
"questions": ["TODO: List questions that may this function answers."]
19+
"questions": ["How to check if all the given values are arrays?"]
1220
}

array/are.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# are
22

3-
Checks if given arguments are all `Arrays`.
3+
Checks if the given arguments are all `Arrays`.
44

55
## Type signature
66

@@ -9,3 +9,26 @@ Checks if given arguments are all `Arrays`.
99
(...xs: any[]) => boolean
1010
```
1111
<!-- prettier-ignore-end -->
12+
13+
## Examples
14+
15+
<!-- prettier-ignore-start -->
16+
```javascript
17+
are([2, 3]);
18+
// ⇒ true
19+
```
20+
21+
```javascript
22+
are([1, 2, 3], []);
23+
// ⇒ true
24+
```
25+
26+
```javascript
27+
are([1, 2, 3], 8, [1, 3], "test");
28+
// ⇒ false
29+
```
30+
<!-- prettier-ignore-end -->
31+
32+
## Questions
33+
34+
- How to check if all the given values are arrays?

array/chunk.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chunk",
3-
"description": "Splits the given array into array of chunks of up to the given length.",
3+
"description": "Splits the given array into an array of chunks of up to the given length.",
44
"signature": "(count: number) => (xs: any[]) => any[]",
55
"examples": [
66
{
@@ -12,5 +12,8 @@
1212
"content": "chunk(3)(['a', 'b', 'c', 'd']);\n// ⇒ [['a', 'b', 'c'], ['d']]"
1313
}
1414
],
15-
"questions": ["TODO: List questions that may this function answer."]
15+
"questions": [
16+
"How to split an array into chunks?",
17+
"How to split an array into chunks of the same size?"
18+
]
1619
}

array/chunk.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# chunk
22

3-
Splits the given array into array of chunks of up to the given length.
3+
Splits the given array into an array of chunks of up to the given length.
44

55
## Type signature
66

@@ -23,3 +23,8 @@ chunk(3)(['a', 'b', 'c', 'd']);
2323
// ⇒ [['a', 'b', 'c'], ['d']]
2424
```
2525
<!-- prettier-ignore-end -->
26+
27+
## Questions
28+
29+
- How to split an array into chunks?
30+
- How to split an array into chunks of the same size?

array/difference.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"name": "difference",
3-
"description": "TODO: Fill short description here.",
3+
"description": "Computes a set difference between the two given arrays.",
44
"signature": "(xs: any[], ys: any[]) => any[]",
55
"examples": [
66
{
77
"language": "javascript",
8-
"content": "difference(); // ⇒ TODO"
8+
"content": "difference([1, 2, 3, 4, 5, 6], [2, 4]);\n// ⇒ [1, 3, 5, 6]"
99
}
1010
],
11-
"questions": ["TODO: List questions that may this function answers."]
11+
"questions": [
12+
"How to find elements which are present in the first array and not in the second?"
13+
]
1214
}

array/difference.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
# difference
22

3+
Computes a set difference between the two given arrays.
4+
35
## Type signature
46

57
<!-- prettier-ignore-start -->
68
```typescript
79
(xs: any[], ys: any[]) => any[]
810
```
911
<!-- prettier-ignore-end -->
12+
13+
## Examples
14+
15+
<!-- prettier-ignore-start -->
16+
```javascript
17+
difference([1, 2, 3, 4, 5, 6], [2, 4]);
18+
// ⇒ [1, 3, 5, 6]
19+
```
20+
<!-- prettier-ignore-end -->
21+
22+
## Questions
23+
24+
- How to find elements which are present in the first array and not in the second?

0 commit comments

Comments
 (0)