Skip to content

Commit c20b9ce

Browse files
committed
Optimize code layout
1 parent 653e1fe commit c20b9ce

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

JavaScript/2-extended.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ const partial = (fn, ...args) => (...rest) => fn(...args.concat(rest));
44

55
// Projection
66

7-
const projection = (meta, obj) => Object.keys(meta)
8-
.reduce((hash, key) => (
9-
hash[key] = meta[key].reduce(
10-
(val, fn, i) => (i === 0 ? obj[fn] : fn(val)), null
11-
), hash
12-
), {});
7+
const projection = (meta, obj) => Object.keys(meta).reduce((hash, key) => (
8+
hash[key] = meta[key]
9+
.reduce((val, fn, i) => (i === 0 ? obj[fn] : fn(val)), null),
10+
hash), {});
1311

1412
// Dataset
1513

JavaScript/3-cached.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
const projection = meta => {
66
const keys = Object.keys(meta);
77
return obj => keys.reduce((hash, key) => (
8-
hash[key] = meta[key].reduce(
9-
(val, fn, i) => (i === 0 ? obj[fn] : fn(val)), null
10-
), hash
11-
), {});
8+
hash[key] = meta[key]
9+
.reduce((val, fn, i) => (i === 0 ? obj[fn] : fn(val)), null),
10+
hash), {});
1211
};
1312

1413
// Dataset

0 commit comments

Comments
 (0)