Swap-Aggregator-Subgraph/node_modules/pull-stream/util/tester.js
2022-07-03 07:27:35 +05:30

12 lines
265 B
JavaScript

var prop = require('./prop')
function id (e) { return e }
module.exports = function tester (test) {
return (
'object' === typeof test && 'function' === typeof test.test //regexp
? function (data) { return test.test(data) }
: prop (test) || id
)
}