Swap-Aggregator-Subgraph/node_modules/pull-stream/util/prop.js
Richa-iitr d211083153 Revert "Revert "added handler""
This reverts commit c36ee8c5ca.
2022-07-03 07:30:05 +05:30

10 lines
283 B
JavaScript

module.exports = function prop (key) {
return key && (
'string' == typeof key
? function (data) { return data[key] }
: 'object' === typeof key && 'function' === typeof key.exec //regexp
? function (data) { var v = key.exec(data); return v && v[0] }
: key
)
}