Skip to content

Commit

Permalink
Merge pull request #14 from relivecc/fix-install
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem725 authored Jan 9, 2020
2 parents d1a9922 + fb0af28 commit b0c753e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions local-cli/link/groupFilesByType.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
const groupBy = require('lodash').groupBy;
const mime = require('mime');
const groupBy = require("lodash").groupBy;
const mime = require("mime");

/**
* Since there are no officially registered MIME types
* for ttf/otf yet http://www.iana.org/assignments/media-types/media-types.xhtml,
* we define two non-standard ones for the sake of parsing
*/
mime.define({
'font/opentype': ['otf'],
'font/truetype': ['ttf'],
});
mime.define(
{
"font/opentype": ["otf"],
"font/truetype": ["ttf"]
},
true
);

/**
* Given an array of files, it groups it by it's type.
Expand All @@ -23,5 +26,5 @@ mime.define({
* the returned object will be: {font: ['fonts/a.ttf'], image: ['images/b.jpg']}
*/
module.exports = function groupFilesByType(assets) {
return groupBy(assets, type => mime.lookup(type).split('/')[0]);
return groupBy(assets, type => mime.lookup(type).split("/")[0]);
};

0 comments on commit b0c753e

Please sign in to comment.