Cleanup code & make sure it has a common code style
This commit is contained in:
@ -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]
|
||||
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
export const filterObject = (obj, fn) => {
|
||||
let key
|
||||
|
||||
|
@ -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'
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
export const setTitle = title => {
|
||||
if (typeof title === 'undefined' || title === '') {
|
||||
document.title = 'Vikunja'
|
||||
|
Reference in New Issue
Block a user