0.1.1 • Published 7 years ago

@delucis/reading-data-omit v0.1.1

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
7 years ago

@delucis/reading-data-omit

Build Status Coverage Status npm (scoped)

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

nametypedefaultdescription
hooksString, 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.
omitString, ArrayThe property/properties to be omitted from the original data.
scopeString, Array'omit'The scope under which reading-data will store this plugin’s data.