aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-07-23 10:01:19 +0200
committerache <ache@ache.one>2018-07-23 10:02:22 +0200
commiteeaeb295fd606430a8cd9b3692c0a8df0ae76382 (patch)
tree10ae9d53e86a2e663fc102b0054ee3002a0856d4
parentbabel support for spread syntax (diff)
follow linter presets
-rw-r--r--__tests__/index.js2
-rw-r--r--src/index.js11
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;