-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert removal of compressed cell colour features * Dependency updates * Use ts-loader instead of babel for typescript (ts-loader does type checking) * Use pako for zlib compression * Replace some uses of Lodash with Ramda * Upgrade from Webpack 4 to Webpack 5
- Loading branch information
1 parent
1282a53
commit e47de8f
Showing
12 changed files
with
909 additions
and
898 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 |
---|---|---|
|
@@ -6,7 +6,6 @@ module.exports = { | |
} | ||
} | ||
], | ||
'@babel/preset-react', | ||
'@babel/preset-typescript' | ||
'@babel/preset-react' | ||
] | ||
}; |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'jest'; | ||
|
||
import { zipLists } from './util'; | ||
|
||
describe('zip arbitrary lists', () => { | ||
it('zips the empty list', () => { | ||
expect(zipLists([])).toEqual([]); | ||
}); | ||
|
||
it('zips singleton lists', () => { | ||
expect(zipLists([[1], [2], [3]])).toEqual([[1, 2, 3]]); | ||
|
||
expect(zipLists([[1]])).toEqual([[1]]); | ||
|
||
expect(zipLists([[1, 2, 3]])).toEqual([[1, 2, 3]]); | ||
}); | ||
|
||
it('zips a pair of lists', () => { | ||
expect( | ||
zipLists([ | ||
[1, 2], | ||
[3, 4], | ||
]) | ||
).toEqual([ | ||
[1, 3], | ||
[2, 4], | ||
]); | ||
}); | ||
|
||
it('zips 3 lists', () => { | ||
expect( | ||
zipLists([ | ||
[1, 2], | ||
[3, 4], | ||
[5, 6], | ||
]) | ||
).toEqual([ | ||
[1, 3, 5], | ||
[2, 4, 6], | ||
]); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Utility functions */ | ||
|
||
import * as R from 'ramda'; | ||
|
||
/** | ||
* zip() but for an arbitrary number of lists. | ||
* Normally you should use R.zip, but sometimes you may want to "zip" | ||
* more than 2 arrays. | ||
* | ||
* Examples: | ||
* zipLists([]) => [] | ||
* zipLists([[1], [2], [3]]) => [[1, 2, 3]] | ||
* zipLists([[1, 2], ['a', 'b']]) => [[1, 'a'], [2, 'b']] | ||
*/ | ||
export const zipLists = <T>(l: Array<Array<T>>): Array<Array<T>> => { | ||
const acc: Array<T> | undefined = R.head(l); | ||
const data: Array<Array<T>> | undefined = R.tail(l); | ||
|
||
if (acc !== undefined && data !== undefined) { | ||
const zipped: Readonly<any[]> = R.isEmpty(data) | ||
? l | ||
: R.reduce(R.zip, acc, data); | ||
return R.map(R.flatten, zipped); | ||
} | ||
return []; | ||
}; |
Oops, something went wrong.