-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brian Boyko
committed
Mar 18, 2021
1 parent
f1bcf1d
commit 1dc0350
Showing
57 changed files
with
1,246 additions
and
1,205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
|
||
## cartesianProduct | ||
|
||
#### import | ||
|
||
```typescript | ||
import cartesianProduct from "https://deno.land/x/[email protected].1/src/array/cartesianProduct.ts"; | ||
import cartesianProduct from "https://deno.land/x/[email protected].2/src/array/cartesianProduct.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
cartesianProduct = <T, U>(a: T[], b: U[]): [T, U][] | ||
``` | ||
Takes two arrays of type T and type U respectively, and creates an array of | ||
tuple type [T, U] for every combination of the elements of a and b. | ||
Takes two arrays of type T and type U respectively, and creates an array of tuple type [T, U] for every combination of the elements of a and b. | ||
#### Source: | ||
|
@@ -29,22 +27,25 @@ export const cartesianProduct = <T, U>(a: T[], b: U[]): [T, U][] => { | |
}; | ||
|
||
export default cartesianProduct; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("cartesianProduct()", () => { | ||
Rhum.testCase( | ||
"Should calculate the cartesian product of two arrays", | ||
() => { | ||
Rhum.asserts.assertEquals(cartesianProduct(["x", "y"], [1, 2]), [ | ||
["x", 1], | ||
["x", 2], | ||
["y", 1], | ||
["y", 2], | ||
]); | ||
}, | ||
); | ||
}); | ||
Rhum.testSuite("cartesianProduct()", () => { | ||
Rhum.testCase( | ||
"Should calculate the cartesian product of two arrays", | ||
() => { | ||
Rhum.asserts.assertEquals(cartesianProduct(["x", "y"], [1, 2]), [ | ||
["x", 1], | ||
["x", 2], | ||
["y", 1], | ||
["y", 2], | ||
]); | ||
}, | ||
); | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
|
||
## chunk | ||
|
||
#### import | ||
|
||
```typescript | ||
import chunk from "https://deno.land/x/[email protected].1/src/array/chunk.ts"; | ||
import chunk from "https://deno.land/x/[email protected].2/src/array/chunk.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
chunk = <T>(arr: T[], size: number = 1): T[][] | ||
``` | ||
|
@@ -29,9 +28,10 @@ export const chunk = <T>(arr: T[], size = 1): T[][] => { | |
}; | ||
|
||
export default chunk; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("chunk()", () => { | ||
|
@@ -70,3 +70,5 @@ Rhum.testSuite("chunk()", () => { | |
}); | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
|
||
## chunkIntoParts | ||
|
||
#### import | ||
|
||
```typescript | ||
import chunkIntoParts from "https://deno.land/x/[email protected].1/src/array/chunkIntoParts.ts"; | ||
import chunkIntoParts from "https://deno.land/x/[email protected].2/src/array/chunkIntoParts.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
chunkIntoParts = <T>(arr: T[], parts = 1): T[][] | ||
``` | ||
Takes an array (arr) and splits it into multiple parts (parts) of equal size. | ||
For example: an array of length 10 split into 3 parts would be split into 4, 4, | ||
and 2 parts | ||
Takes an array (arr) and splits it into multiple parts (parts) of equal size. For example: an array of length 10 split into 3 parts would be split into 4, 4, and 2 parts | ||
#### Source: | ||
|
@@ -27,9 +24,10 @@ export const chunkIntoParts = <T>(arr: T[], parts = 1): T[][] => { | |
}; | ||
|
||
export default chunkIntoParts; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("chunkIntoParts()", () => { | ||
|
@@ -91,3 +89,5 @@ Rhum.testSuite("chunkIntoParts()", () => { | |
}); | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
|
||
## difference | ||
|
||
#### import | ||
|
||
```typescript | ||
import difference from "https://deno.land/x/[email protected].1/src/array/difference.ts"; | ||
import difference from "https://deno.land/x/[email protected].2/src/array/difference.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
difference = <T>(a: T[], b: T[]): T[] | ||
``` | ||
Takes two arrays (a, b) and returns an array of elements in a that do not exist | ||
in b | ||
Takes two arrays (a, b) and returns an array of elements in a that do not exist in b | ||
#### Source: | ||
|
@@ -25,9 +23,10 @@ export const difference = <T>(a: T[], b: T[]): T[] => | |
differenceBy(identity, a, b); | ||
|
||
export default difference; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("difference()", () => { | ||
|
@@ -38,3 +37,5 @@ Rhum.testSuite("difference()", () => { | |
}); | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
|
||
## differenceBy | ||
|
||
#### import | ||
|
||
```typescript | ||
import differenceBy from "https://deno.land/x/[email protected].1/src/array/differenceBy.ts"; | ||
import differenceBy from "https://deno.land/x/[email protected].2/src/array/differenceBy.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
differenceBy = <T>(iteratee: Iteratee<T, any>, a: T[], b: T[]): T[] | ||
``` | ||
Takes two arrays (a, b) and an iteratee. It returns an array of elements in a | ||
where the return of iteratee(a) does not equal any return of the map of b over | ||
iteratee. In other words, after running the function on both, remove any | ||
elements where iteratee(a) matches any iteratee(b) | ||
Takes two arrays (a, b) and an iteratee. It returns an array of elements in a where the return of iteratee(a) does not equal any return of the map of b over iteratee. In other words, after running the function on both, remove any elements where iteratee(a) matches any iteratee(b) | ||
#### Source: | ||
|
@@ -38,9 +34,10 @@ export const differenceBy = <T>( | |
}; | ||
|
||
export default differenceBy; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("differenceBy()", () => { | ||
|
@@ -51,3 +48,5 @@ Rhum.testSuite("differenceBy()", () => { | |
}); | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
|
||
## differenceWith | ||
|
||
#### import | ||
|
||
```typescript | ||
import differenceWith from "https://deno.land/x/[email protected].1/src/array/differenceWith.ts"; | ||
import differenceWith from "https://deno.land/x/[email protected].2/src/array/differenceWith.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
differenceWith = <T>( | ||
comparator: Comparator<T>, | ||
|
@@ -16,9 +15,7 @@ differenceWith = <T>( | |
) | ||
``` | ||
|
||
Takes two arrays (a, b) and a comparator (which will return a boolean). It | ||
returns an array of elements in a where no element in b returns true for | ||
comparator(elemA, elemB) | ||
Takes two arrays (a, b) and a comparator (which will return a boolean). It returns an array of elements in a where no element in b returns true for comparator(elemA, elemB) | ||
|
||
#### Source: | ||
|
||
|
@@ -40,9 +37,10 @@ export const differenceWith = <T>( | |
}; | ||
|
||
export default differenceWith; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("differenceWith()", () => { | ||
|
@@ -71,3 +69,5 @@ Rhum.testSuite("differenceWith()", () => { | |
}); | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
|
||
## dropWhile | ||
|
||
#### import | ||
|
||
```typescript | ||
import dropWhile from "https://deno.land/x/[email protected].1/src/array/dropWhile.ts"; | ||
import dropWhile from "https://deno.land/x/[email protected].2/src/array/dropWhile.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
dropWhile = <T>( | ||
arr: T[], | ||
predicate: Predicate<T>, | ||
): T[] | ||
): T[] | ||
``` | ||
|
||
Takes an array (arr) and a Predicate (predicate) which will return boolean. It | ||
iterates over the array and will drop (or more accurately, not copy) all | ||
elements until it reaches an element where predicate(element) returns false. It | ||
returns a new array. | ||
Takes an array (arr) and a Predicate (predicate) which will return boolean. It iterates over the array and will drop (or more accurately, not copy) all elements until it reaches an element where predicate(element) returns false. It returns a new array. | ||
|
||
#### Source: | ||
|
||
|
@@ -38,9 +34,10 @@ export const dropWhile = <T>( | |
}; | ||
|
||
export default dropWhile; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("dropWhile()", () => { | ||
|
@@ -56,3 +53,5 @@ Rhum.testSuite("dropWhile()", () => { | |
); | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
|
||
## dropWhileRight | ||
|
||
#### import | ||
|
||
```typescript | ||
import dropWhileRight from "https://deno.land/x/[email protected].1/src/array/dropWhileRight.ts"; | ||
import dropWhileRight from "https://deno.land/x/[email protected].2/src/array/dropWhileRight.ts" | ||
``` | ||
|
||
#### signature | ||
|
||
```typescript | ||
dropWhileRight = <T>( | ||
arr: T[], | ||
predicate: Predicate<T>, | ||
): T[] | ||
``` | ||
|
||
Takes an array (arr) and a Predicate (predicate) which will return boolean. It | ||
iterates over the array starting from the last element in the array, towards the | ||
first element, and will drop (or more accurately, not copy) all elements until | ||
it reaches an element where predicate(element) returns false. It returns a new | ||
array. | ||
Takes an array (arr) and a Predicate (predicate) which will return boolean. It iterates over the array starting from the last element in the array, towards the first element, and will drop (or more accurately, not copy) all elements until it reaches an element where predicate(element) returns false. It returns a new array. | ||
|
||
#### Source: | ||
|
||
|
@@ -39,9 +34,10 @@ export const dropWhileRight = <T>( | |
}; | ||
|
||
export default dropWhileRight; | ||
|
||
``` | ||
|
||
#### Test Examples: | ||
#### Test Examples: | ||
|
||
```typescript | ||
Rhum.testSuite("dropWhileRight()", () => { | ||
|
@@ -57,3 +53,5 @@ Rhum.testSuite("dropWhileRight()", () => { | |
); | ||
}); | ||
``` | ||
|
||
|
Oops, something went wrong.