Removed unnecessary functions in utils.js

This commit is contained in:
JubbeArt 2018-07-29 04:09:05 +02:00
parent dbe55b9b2c
commit 4d0632bfd2
5 changed files with 10 additions and 30 deletions

View file

@ -2,7 +2,7 @@
[Removeddit](https://removeddit.com) is a site for viewing removed comments / threads from [Reddit](https://www.reddit.com).
Just go to any reddit thread and change the `reddit` in the URL to `removeddit` to see all removed comments.
This is a done by comparing the comments being stored in [Jason Baumgartners](https://pushshift.io/) [Pushshift Reddit API](https://github.com/pushshift/api) and the ones from Reddit API. The frontend is written in React and uses Sass as the CSS Preprocessor. There is also a seperate [backend](https://github.com/JubbeArt/removeddit-api) used for storing what threads that have been removed by mods.
This is a done by comparing the comments being stored in [Jason Baumgartners](https://pushshift.io/) [Pushshift Reddit API](https://github.com/pushshift/api) and the ones from Reddit API. The frontend is written in [React](https://reactjs.org/) and uses [Sass](https://sass-lang.com/) as the CSS Preprocessor. There is also a seperate [backend](https://github.com/JubbeArt/removeddit-api) used for storing what threads that have been removed by mods.
# Development
Download either [Yarn](https://yarnpkg.com/en/docs/install) (the one I use) or [npm](https://www.npmjs.com/get-npm)

4
TODO
View file

@ -3,3 +3,7 @@ update header links active (NavLinks)
make sort/filter state local
old.removeddit.com
take utc from thread and limit pushshift comments
rename show to filter

View file

@ -1,4 +0,0 @@
take utc from thread and limit pushshift comments
rename show to filter

View file

@ -23,15 +23,11 @@ const sortKey = 'commentSort'
const filterKey = 'commentFilter'
class GlobalState extends Container {
constructor () {
super()
this.state = {
commentSort: get(sortKey, sort.top),
commentFilter: get(filterKey, filter.removedDeleted),
statusText: '',
statusImage: undefined
}
state = {
commentSort: get(sortKey, sort.top),
commentFilter: get(filterKey, filter.removedDeleted),
statusText: '',
statusImage: undefined
}
setCommentSort (sortType) {

View file

@ -8,12 +8,6 @@ export const flatten = arr => arr.reduce(
[]
)
// Same as: array => Set => array
export const unique = arr => arr.filter((value, index) => arr.indexOf(value) === index)
// Everything in arr1 that is not in arr2
export const difference = (arr1, arr2) => arr1.filter(x => !arr2.includes(x))
// Take on big array and split it into an array of chunks with correct size
export const chunk = (arr, size) => {
const chunks = []
@ -23,16 +17,6 @@ export const chunk = (arr, size) => {
return chunks
}
// Make multiple requests to the same url, with an array of data (usually comment IDs)
// This is needed since there is a limit on how long a url can be
export const fetchMultiple = (url, arr, header, size = 100) => {
const subArrays = chunk(arr, size)
return Promise.all(subArrays.map(subArr => window.fetch(url + subArr.join(), header)))
}
export const jsonMultiple = responses => Promise.all(responses.map(response => response.json()))
// Change bases
export const toBase36 = number => parseInt(number, 10).toString(36)
export const toBase10 = numberString => parseInt(numberString, 36)