Skip to content

Commit 6d28e3e

Browse files
committed
Fix code style
1 parent b48016e commit 6d28e3e

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

Diff for: JavaScript/2-get-set.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const obj = {
66
},
77
set x(v) {
88
console.log('set', v);
9-
}
9+
},
1010
};
1111

1212
obj.x = 5;

Diff for: JavaScript/3-proxy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const person = new Proxy(data, {
1111
console.log('set', key, val);
1212
obj[key] = val;
1313
return true;
14-
}
14+
},
1515
});
1616

1717
console.dir({ 'person.born': person.born });

Diff for: JavaScript/4-has.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,28 @@ const data = { name: 'Marcus Aurelius', city: 'Rome', born: 121 };
55
const person = new Proxy(data, {
66
has(obj, key) {
77
console.log('check', key);
8-
return (key in obj || key === 'age');
8+
return key in obj || key === 'age';
99
},
1010
get(obj, key) {
1111
console.log('get', key);
1212
if (key === 'age') {
1313
return (
14-
new Date().getFullYear() -
15-
new Date(obj.born.toString()).getFullYear()
14+
new Date().getFullYear() - new Date(obj.born.toString()).getFullYear()
1615
);
1716
}
1817
return obj[key];
19-
}
18+
},
2019
});
2120

22-
console.log('Try \'age\' in person');
21+
console.log("Try 'age' in person");
2322
if ('age' in person) {
2423
console.log('Try person.age');
2524
if (person.age) {
26-
console.log('Try person[\'age\']');
25+
console.log("Try person['age']");
2726
if (person['age']) {
2827
console.log({
2928
born: person.born,
30-
age: person.age
29+
age: person.age,
3130
});
3231
}
3332
}

Diff for: JavaScript/5-delete.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const person = new Proxy(data, {
66
deleteProperty(obj, key) {
77
console.log('delete', key);
88
return true;
9-
}
9+
},
1010
});
1111

1212
console.log(person);

Diff for: JavaScript/6-keys.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const data = { name: 'Marcus Aurelius', city: 'Rome', _born: 121 };
55
const person = new Proxy(data, {
66
ownKeys(obj) {
77
return Object.keys(obj).filter((name) => !name.startsWith('_'));
8-
}
8+
},
99
});
1010

1111
console.dir(Object.keys(person));

Diff for: JavaScript/7-apply.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const amax = new Proxy(max, {
66
apply(target, context, args) {
77
console.log('apply', target.name, args);
88
return args.reduce(target);
9-
}
9+
},
1010
});
1111

1212
console.log(max(7, 3, 12, 5, 0, 4, 8, 5));

Diff for: JavaScript/9-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Config {
1010
const steps = key.split('.');
1111
for (const step of steps) {
1212
const next = data[step];
13-
if (!next) return;
13+
if (!next) return null;
1414
data = next;
1515
}
1616
return data;

0 commit comments

Comments
 (0)