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

Decrease package size #65

Merged
merged 1 commit into from
Sep 5, 2024
Merged

Decrease package size #65

merged 1 commit into from
Sep 5, 2024

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Sep 5, 2024

This refactors the codebase to remove a few bytes from the package size.

@@ -57,7 +53,7 @@ const getErrorInstance = (error, {command}) => error?.message.startsWith('Comman

const getErrorOutput = ({exitCode, signalCode}) => ({
// `exitCode` can be a negative number (`errno`) when the `error` event is emitted on the `instance`
...(exitCode === null || exitCode < 1 ? {} : {exitCode}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null < 1 is true :)

@ehmicky ehmicky force-pushed the refactor branch 6 times, most recently from 3817682 to 7f90d40 Compare September 5, 2024 19:42
@@ -69,6 +65,6 @@ const getOutputs = ({state: {stdout, stderr, output}, command, start}) => ({
durationMs: Number(process.hrtime.bigint() - start) / 1e6,
});

const getOutput = input => input?.at(-1) === '\n'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That ?. is not needed since the argument is always a string.

@sindresorhus sindresorhus merged commit f54d720 into main Sep 5, 2024
12 checks passed
@sindresorhus sindresorhus deleted the refactor branch September 5, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants