Licence
GPL-3.0
Version
0.1.0
Deps
1
Vulns
1
Weekly
0
DeprecatedThis package is deprecated
@delucis/reading-data-pick
A plugin for @delucis/reading-data
that allows easy use of lodash.pick.
Installation
npm install --save @delucis/reading-data-pick
Usage
const RD = require('@delucis/reading-data')
const PICK = require('@delucis/reading-data-pick')
RD.preloadData({
myArticle: {
text: 'This is a short article that is well worth reading.',
meta: 'This is some superfluous metadata we’d rather not include'
}
})
RD.use(PICK, {
scope: 'myArticle',
pick: 'text'
})
RD.run().then((res) => {
console.log(res.data.myArticle)
// logs: { text: 'This is a short article that is well worth reading.' }
})
Options
| name | type | default | description |
|---|---|---|---|
hooks |
String, Object |
'process' |
The reading-data hook that on which the scope should be picked. Can be scoped by passing an object with scopes as keys, hooks as values. |
pick |
String, Array |
The property/properties to be picked (i.e. included) from the original data. | |
scope |
String, Array |
'pick' |
The scope under which reading-data will store this plugin’s data. |