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

View file

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

View file

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