1
0

Cleanup code & make sure it has a common code style

This commit is contained in:
kolaente
2020-09-05 22:35:52 +02:00
parent 4a8b15e7be
commit a8a7f70a3c
132 changed files with 6821 additions and 6595 deletions

View File

@ -1,6 +1,5 @@
export const applyDrag = (arr, dragResult) => {
const { removedIndex, addedIndex, payload } = dragResult
const {removedIndex, addedIndex, payload} = dragResult
if (removedIndex === null && addedIndex === null) return arr
const result = [...arr]

View File

@ -19,7 +19,7 @@ export function objectToCamelCase(object) {
// Recursive processing
// Prevent processing for some cases
if(object[m] === null) {
if (object[m] === null) {
continue
}
@ -31,7 +31,7 @@ export function objectToCamelCase(object) {
}
// Call it again for nested objects
if(typeof object[m] === 'object') {
if (typeof object[m] === 'object') {
parsedObject[camelCase(m)] = objectToCamelCase(object[m])
}
}
@ -56,7 +56,7 @@ export function objectToSnakeCase(object) {
// Recursive processing
// Prevent processing for some cases
if(
if (
object[m] === null ||
(object[m] instanceof Date)
) {
@ -71,7 +71,7 @@ export function objectToSnakeCase(object) {
}
// Call it again for nested objects
if(typeof object[m] === 'object') {
if (typeof object[m] === 'object') {
parsedObject[snakeCase(m)] = objectToSnakeCase(object[m])
}
}

View File

@ -1,4 +1,3 @@
export const filterObject = (obj, fn) => {
let key

View File

@ -1,4 +1,3 @@
export const saveListView = (listId, routeName) => {
const savedListView = localStorage.getItem('listView')
let savedListViewJson = false
@ -7,7 +6,7 @@ export const saveListView = (listId, routeName) => {
}
let listView = {}
if(savedListViewJson) {
if (savedListViewJson) {
listView = savedListViewJson
}
@ -18,7 +17,7 @@ export const saveListView = (listId, routeName) => {
export const getListView = listId => {
// Remove old stored settings
const savedListView = localStorage.getItem('listView')
if(savedListView !== null && savedListView.startsWith('list.')) {
if (savedListView !== null && savedListView.startsWith('list.')) {
localStorage.removeItem('listView')
}
@ -28,7 +27,7 @@ export const getListView = listId => {
const savedListViewJson = JSON.parse(savedListView)
if(!savedListViewJson[listId]) {
if (!savedListViewJson[listId]) {
return 'list.list'
}

View File

@ -1,4 +1,3 @@
export const setTitle = title => {
if (typeof title === 'undefined' || title === '') {
document.title = 'Vikunja'