mirror of
https://github.com/Instadapp/Swap-Aggregator-Subgraph.git
synced 2024-07-29 21:57:12 +00:00
10 lines
283 B
JavaScript
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
|
|
)
|
|
}
|