From 36b22af6798c6a2b48c0f4f884fa2e681ab14813 Mon Sep 17 00:00:00 2001 From: Ricardo Gobbo de Souza Date: Fri, 10 Jul 2020 17:33:49 -0300 Subject: [PATCH] style: formatting --- lib/google-fonts.js | 20 ++++++++++---------- lib/module.js | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/google-fonts.js b/lib/google-fonts.js index 938e59a..c86b33c 100644 --- a/lib/google-fonts.js +++ b/lib/google-fonts.js @@ -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) { @@ -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', @@ -224,8 +224,8 @@ 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() @@ -233,14 +233,14 @@ export default class 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) } diff --git a/lib/module.js b/lib/module.js index 6b272a8..9f3b2bb 100644 --- a/lib/module.js +++ b/lib/module.js @@ -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, @@ -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