git ssb

2+

Dominic / pull-stream



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 PM
Parent: 4030fd72088498cc22acca950c4a1bb121937cc0

Files changed

sinks/find.jschanged
throughs/async-map.jschanged
throughs/map.jschanged
throughs/unique.jschanged
util/tester.jschanged
util/id.jsdeleted
sinks/find.jsView
@@ -1,7 +1,7 @@
11 'use strict'
22
3-var id = require('../util/id')
3+function id (e) { return e }
44 var prop = require('../util/prop')
55 var drain = require('./drain')
66
77 module.exports = function find (test, cb) {
@@ -24,4 +24,5 @@
2424 }
2525
2626
2727
28+
throughs/async-map.jsView
@@ -1,7 +1,7 @@
11 'use strict'
22
3-var id = require('../util/id')
3+function id (e) { return e }
44 var prop = require('../util/prop')
55
66 module.exports = function asyncMap (map) {
77 if(!map) return id
@@ -39,4 +39,5 @@
3939 }
4040 }
4141 }
4242
43+
throughs/map.jsView
@@ -1,6 +1,7 @@
11 'use strict'
22
3+function id (e) { return e }
34 var prop = require('../util/prop')
45
56 module.exports = function map (mapper) {
67 if(!mapper) return id
throughs/unique.jsView
@@ -1,7 +1,7 @@
11 'use strict'
22
3-var id = require('../util/id')
3+function id (e) { return e }
44 var prop = require('../util/prop')
55 var filter = require('./filter')
66
77 //drop items you have already seen.
@@ -14,4 +14,5 @@
1414 else seen[key] = true
1515 return !invert //true by default
1616 })
1717 }
18+
util/tester.jsView
@@ -1,6 +1,8 @@
11 var prop = require('./prop')
22
3+function id (e) { return e }
4+
35 module.exports = function tester (test) {
46 return (
57 'object' === typeof test && 'function' === typeof test.test //regexp
68 ? function (data) { return test.test(data) }
util/id.jsView
@@ -1,1 +1,0 @@
1-module.exports = function id (item) { return item }

Built with git-ssb-web