Skip to content

Commit

Permalink
style: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza committed Jul 10, 2020
1 parent 48b3cad commit 36b22af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions lib/google-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class GoogleFontsHelper {
}

constructURL () {
const { families, subsets, display } = this.fonts
const { families, display, subsets } = this.fonts
const family = convertFamiliesToArray(families || {})

if (family.length < 1) {
Expand All @@ -178,16 +178,16 @@ export default class GoogleFontsHelper {
family
}

if (isValidDisplay(display)) {
query.display = display
}

const subset = Array.isArray(subsets) ? subsets : [subsets]

if (subset.length > 0) {
query.subset = subset.join(',')
}

if (isValidDisplay(display)) {
query.display = display
}

return unescape(format({
protocol: 'https',
hostname: 'fonts.googleapis.com',
Expand Down Expand Up @@ -224,23 +224,23 @@ export default class GoogleFontsHelper {

const result = {}
const families = convertFamiliesObject(searchParams.getAll('family'))
const subsets = searchParams.get('subset')
const display = searchParams.get('display')
const subsets = searchParams.get('subset')

if (Object.keys(families).length < 1) {
return new GoogleFontsHelper()
}

result.families = families

if (subsets) {
result.subsets = subsets.split(',')
}

if (isValidDisplay(display)) {
result.display = display
}

if (subsets) {
result.subsets = subsets.split(',')
}

return new GoogleFontsHelper(result)
}

Expand Down
6 changes: 3 additions & 3 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module.exports = function (moduleOptions) {
this.nuxt.hook('build:before', async () => {
const options = {
families: {},
subsets: [],
display: null,
subsets: [],
prefetch: true,
preconnect: true,
download: false,
Expand All @@ -25,8 +25,8 @@ module.exports = function (moduleOptions) {

const googleFontsHelper = new GoogleFontsHelper({
families: options.families,
subsets: options.subsets,
display: options.display
display: options.display,
subsets: options.subsets
})

// merge fonts from valid head link
Expand Down

0 comments on commit 36b22af

Please sign in to comment.