remove lodash forEach to reduce bundle size (#156)

This commit is contained in:
Nolan Lawson 2018-04-17 21:47:39 -07:00 committed by GitHub
parent 7c548018c1
commit 74ea773c25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View file

@ -1,7 +1,6 @@
import { getIdsThatRebloggedThisStatus, getNotificationIdsForStatuses } from './statuses'
import { store } from '../_store/store'
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
import forEach from 'lodash-es/forEach'
import isEqual from 'lodash-es/isEqual'
import {
deleteStatusesAndNotifications as deleteStatusesAndNotificationsFromDatabase
@ -12,7 +11,8 @@ function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) {
keys.forEach(key => {
let timelineData = store.getAllTimelineData(instanceName, key)
forEach(timelineData, (ids, timelineName) => {
Object.keys(timelineData).forEach(timelineName => {
let ids = timelineData[timelineName]
if (!timelineFilter(timelineName)) {
return
}

View file

@ -14,8 +14,6 @@ import {
USERNAME_LOWERCASE
} from './constants'
import forEach from 'lodash-es/forEach'
const openReqs = {}
const databaseCache = {}
@ -47,8 +45,8 @@ export function getDatabase (instanceName) {
? db.createObjectStore(name, init)
: db.createObjectStore(name)
if (indexes) {
forEach(indexes, (indexValue, indexKey) => {
store.createIndex(indexKey, indexValue)
Object.keys(indexes).forEach(indexKey => {
store.createIndex(indexKey, indexes[indexKey])
})
}
}

View file

@ -69,7 +69,6 @@ module.exports = {
},
plugins: [
new LodashModuleReplacementPlugin({
collections: true,
caching: true
})
].concat(isDev ? [