0.1.1 • Published 7 years ago
@delucis/reading-data-omit v0.1.1
@delucis/reading-data-omit
A plugin for @delucis/reading-data
that allows easy use of lodash.omit
.
Installation
npm install --save @delucis/reading-data-omit
Usage
const RD = require('@delucis/reading-data')
const OMIT = require('@delucis/reading-data-omit')
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(OMIT, {
scope: 'myArticle',
omit: 'meta'
})
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 should process the scope, omitting keys. Can be scoped by passing an object with scopes as keys, hooks as values. |
omit | String , Array | The property/properties to be omitted from the original data. | |
scope | String , Array | 'omit' | The scope under which reading-data will store this plugin’s data. |