Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the bundle size by removing some lodash usage #1394

Merged
merged 11 commits into from
Apr 9, 2024
Prev Previous commit
Next Next commit
Remove lodash/transform
  • Loading branch information
SukkaW committed Apr 9, 2024
commit 091d64884b65e7a881a96d0d8ed752f23e63603d
12 changes: 4 additions & 8 deletions src/lib/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Loggin functions.
*/
import Table from 'cli-table3'
import transform from 'lodash/transform'
import { IgnoredUpgrade } from '../types/IgnoredUpgrade'
import { Index } from '../types/IndexType'
import { Options } from '../types/Options'
Expand Down Expand Up @@ -87,13 +86,10 @@ export function printSimpleJoinedString(object: any, join: string) {
/** Prints an object sorted by key. */
export function printSorted<T extends { [key: string]: any }>(options: Options, obj: T, loglevel: LogLevel) {
const sortedKeys = Object.keys(obj).sort() as (keyof T)[]
const objSorted = transform(
sortedKeys,
(accum, key) => {
accum[key] = obj[key]
},
{} as T,
)
const objSorted = sortedKeys.reduce<T>((accum, key) => {
accum[key] = obj[key]
return accum
}, {} as T)
print(options, objSorted, loglevel)
}

Expand Down