From eeaeb295fd606430a8cd9b3692c0a8df0ae76382 Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 23 Jul 2018 10:01:19 +0200 Subject: follow linter presets --- __tests__/index.js | 2 +- src/index.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/__tests__/index.js b/__tests__/index.js index a8e6e15..56158bb 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -534,7 +534,7 @@ test('alone brace', t => { test('defaultValue true', t => { const toParse = 'visible'; - const r = parse(toParse, 0, {defaultValue: "true"}); + const r = parse(toParse, 0, {defaultValue: 'true'}); t.is(r.prop.visible, 'true'); t.is(r.eaten, 'visible'); }); diff --git a/src/index.js b/src/index.js index 8d65e40..c47fb38 100644 --- a/src/index.js +++ b/src/index.js @@ -20,11 +20,10 @@ function parse(value, indexNext, userConfig) { let letsEat = ''; let stopOnBrace = false; let errorDetected = false; - let config = {...defaultConfig, ...userConfig}; - + const config = {...defaultConfig, ...userConfig}; // Make defaultValue a function if it isn't - if( typeof(config.defaultValue) != "function" ) { + if (typeof (config.defaultValue) !== 'function') { const {defaultValue} = config; config.defaultValue = () => defaultValue; } @@ -162,11 +161,11 @@ function parse(value, indexNext, userConfig) { return nothingHappend; } if (labelFirst !== 'id' && labelFirst !== 'class') { - if( labelSecond != undefined ) { - prop[labelFirst] = labelSecond; - } else { // Here, we have a attribute without value + if (labelSecond === undefined) { // Here, we have a attribute without value // so it's user defined prop[labelFirst] = config.defaultValue(labelFirst); + } else { + prop[labelFirst] = labelSecond; } } break; -- cgit v1.2.3