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

Add option mimeTypesForce #349

Merged
merged 2 commits into from
Dec 13, 2018

Conversation

gpoitch
Copy link
Member

@gpoitch gpoitch commented Dec 12, 2018

What kind of change does this PR introduce?
Feature

Did you add tests for your changes?
Yes

Summary
Exposes the force option to the underlying node-mime module.
See: #346

Does this PR introduce a breaking change?
No

@jsf-clabot
Copy link

jsf-clabot commented Dec 12, 2018

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Dec 12, 2018

Codecov Report

Merging #349 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #349   +/-   ##
======================================
  Coverage    96.8%   96.8%           
======================================
  Files           7       7           
  Lines         250     250           
======================================
  Hits          242     242           
  Misses          8       8
Impacted Files Coverage Δ
index.js 97.43% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a59b9fd...8c06e96. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 12, 2018

Codecov Report

Merging #349 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #349      +/-   ##
==========================================
+ Coverage    96.8%   96.82%   +0.02%     
==========================================
  Files           7        7              
  Lines         250      252       +2     
==========================================
+ Hits          242      244       +2     
  Misses          8        8
Impacted Files Coverage Δ
index.js 97.56% <100%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a59b9fd...ec2e6da. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Looks good, what about avoid new option in favor reuse existing. Example:

{
  mimeTypes: {'foo' => [bar]}
}

Reuse current option.

{
  mimeTypes: { typeMap: ['foo' => [bar]], force: true }
}

In code we just check:

if (options.mimeTypes) {
  let typeMap = options.mimeTypes;
  let force = false;

  if (options.mimeTypes.typeMap) {
    typeMap = options.mimeTypes.typeMap;
    force = options.mimeTypes.force
  }

  mime.define(typeMap, force);
}

@gpoitch
Copy link
Member Author

gpoitch commented Dec 12, 2018

@evilebottnawi good idea. done.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Good job.

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.

3 participants