Skip to content

Commit

Permalink
Replace lodash with es-toolkit (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj authored Oct 9, 2024
1 parent 9c1dedf commit 2090ad9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"cli-cursor": "^4.0.0",
"cli-truncate": "^4.0.0",
"code-excerpt": "^4.0.0",
"es-toolkit": "^1.22.0",
"indent-string": "^5.0.0",
"is-in-ci": "^0.1.0",
"lodash": "^4.17.21",
"patch-console": "^2.0.0",
"react-reconciler": "^0.29.0",
"scheduler": "^0.23.0",
Expand All @@ -72,7 +72,6 @@
"@faker-js/faker": "^8.3.1",
"@sindresorhus/tsconfig": "^5.0.0",
"@types/benchmark": "^2.1.2",
"@types/lodash": "^4.14.202",
"@types/ms": "^0.7.31",
"@types/node": "^20.10.4",
"@types/react": "^18.2.43",
Expand Down
9 changes: 4 additions & 5 deletions src/ink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import process from 'node:process';
import React, {type ReactNode} from 'react';
import throttle from 'lodash/throttle.js';
import {type DebouncedFunc} from 'lodash';
import {throttle} from 'es-toolkit/compat';
import ansiEscapes from 'ansi-escapes';
import isInCi from 'is-in-ci';
import autoBind from 'auto-bind';
Expand Down Expand Up @@ -31,7 +30,7 @@ export type Options = {
export default class Ink {
private readonly options: Options;
private readonly log: LogUpdate;
private readonly throttledLog: LogUpdate | DebouncedFunc<LogUpdate>;
private readonly throttledLog: LogUpdate;
// Ignore last render after unmounting a tree to prevent empty output before exit
private isUnmounted: boolean;
private lastOutput: string;
Expand Down Expand Up @@ -62,10 +61,10 @@ export default class Ink {
this.log = logUpdate.create(options.stdout);
this.throttledLog = options.debug
? this.log
: throttle(this.log, undefined, {
: (throttle(this.log, undefined, {
leading: true,
trailing: true,
});
}) as unknown as LogUpdate);

// Ignore last render after unmounting a tree to prevent empty output before exit
this.isUnmounted = false;
Expand Down

0 comments on commit 2090ad9

Please sign in to comment.