Commit b97db9e7ed0815998c76014c59a9bfb764eae06d
if a inlining a function is less code than requirering it, inline it
Dominic Tarr committed on 5/19/2016, 8:22:26 PMParent: 4030fd72088498cc22acca950c4a1bb121937cc0
Files changed
sinks/find.js | changed |
throughs/async-map.js | changed |
throughs/map.js | changed |
throughs/unique.js | changed |
util/tester.js | changed |
util/id.js | deleted |
sinks/find.js | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 | |
2 | 2 | |
3 | -var id = require('../util/id') | |
3 | +function id (e) { return e } | |
4 | 4 | var prop = require('../util/prop') |
5 | 5 | var drain = require('./drain') |
6 | 6 | |
7 | 7 | module.exports = function find (test, cb) { |
@@ -24,4 +24,5 @@ | ||
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | + |
throughs/async-map.js | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 | |
2 | 2 | |
3 | -var id = require('../util/id') | |
3 | +function id (e) { return e } | |
4 | 4 | var prop = require('../util/prop') |
5 | 5 | |
6 | 6 | module.exports = function asyncMap (map) { |
7 | 7 | if(!map) return id |
@@ -39,4 +39,5 @@ | ||
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | + |
throughs/map.js | ||
---|---|---|
@@ -1,6 +1,7 @@ | ||
1 | 1 | |
2 | 2 | |
3 | +function id (e) { return e } | |
3 | 4 | var prop = require('../util/prop') |
4 | 5 | |
5 | 6 | module.exports = function map (mapper) { |
6 | 7 | if(!mapper) return id |
throughs/unique.js | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 | |
2 | 2 | |
3 | -var id = require('../util/id') | |
3 | +function id (e) { return e } | |
4 | 4 | var prop = require('../util/prop') |
5 | 5 | var filter = require('./filter') |
6 | 6 | |
7 | 7 | //drop items you have already seen. |
@@ -14,4 +14,5 @@ | ||
14 | 14 | else seen[key] = true |
15 | 15 | return !invert //true by default |
16 | 16 | }) |
17 | 17 | } |
18 | + |
util/tester.js | ||
---|---|---|
@@ -1,6 +1,8 @@ | ||
1 | 1 | var prop = require('./prop') |
2 | 2 | |
3 | +function id (e) { return e } | |
4 | + | |
3 | 5 | module.exports = function tester (test) { |
4 | 6 | return ( |
5 | 7 | 'object' === typeof test && 'function' === typeof test.test //regexp |
6 | 8 | ? function (data) { return test.test(data) } |
util/id.js | ||
---|---|---|
@@ -1,1 +1,0 @@ | ||
1 | -module.exports = function id (item) { return item } |
Built with git-ssb-web