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

refactor: update contentDisposition function with ES6+ syntax for clarity #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ayoub-Mabrouk
Copy link

refactor: update contentDisposition function with ES6+ syntax for clarity

  • Replaced var with const for immutable values.
  • Used default parameters and destructuring for options to simplify handling.
  • Removed redundant variable initialization, enhancing readability.

This change modernizes the code, making it more concise and consistent with current JavaScript standards.

…rity

- Replaced �ar with const for immutable values.
- Used default parameters and destructuring for options to simplify handling.
- Removed redundant variable initialization, enhancing readability.

This change modernizes the code, making it more concise and consistent with current JavaScript standards.
Comment on lines -143 to +144
function contentDisposition (filename, options) {
var opts = options || {}

// get type
var type = opts.type || 'attachment'
function contentDisposition (filename, options = {}) {
const { type = 'attachment', fallback } = options
Copy link
Contributor

Choose a reason for hiding this comment

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

@Ayoub-Mabrouk This code does not handle passing null as options but the previous code did.

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