@nofrills/scrubs
Scrubs an object of sensitive data.
Last updated 3 months ago by teegee .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nofrills/scrubs 
SYNC missed versions from official npm registry.

@nofrills/scrubs

npm

No frills data scrubbing to help remove sensitive data from object properties and strings.

Install

npm install --save @nofrills/scrubs

Quick Start

Javascript

const scrubs = require('@nofrills/scrubs')
const data = {
  password: 'password123'
}
const scrubbed = scrubs.scrub(data)
// -> should return { password: "<secured>" }

Typescript

import { scrub } from '@nofrills/scrubs'
const data = {
  password: 'password123'
}
const scrubbed = scrub(data)
// -> should return { password: "<secured>" }

NOTE: From here on, we'll use Javascript in examples.

Options

You can also use an options object to inject some customizations and extensions.

{
  properties: ['apikey', 'api_key', 'password'],
  text: '<secured>'
}

Once you've created your options, you can pass it to the Scrubs class.

const Scrubs = require('@nofrills/scrubs').Scrubs
const scrubber = new Scrubs({
  secured: {
    properties: ['apikey', 'api_key', 'password'],
    text: '<password>'
  }
scrubber.scrub({ password: "password123" })
// -> will replace password with "<password>"
})

Properties

Properties are an array of strings representing the properties on an object that require securing. By default, apikey, api_key, and password are secured.

Extensibility

You can extend how scrubs works by registering custom handlers to scrub a provided value.

In Typescript parlance, we define a callback via the Scrubber<T> type.

type Scrubber<T> = (value: T, options: ScrubsOptions, instance: Scrubs) => T

Simply create your handler and register it before scrubbing, like so:

Javascript

const R = require('@nofrills/scrubs').Registry

const Handler = (value, options, scrubs) => {
  // TODO: Something super fantastic that scrubs
  // the value of sensitive data.
  return value
}

R.register('string', Handler)

License

Copyright 2018 NativeCode Development opensource@nativecode.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 11.0.1-canary.2                                ...           canary (7 months ago)
  • 11.0.1                                ...           latest (3 months ago)
  • 11.0.1-next.1                                ...           next (3 months ago)

112 Versions

  • 11.0.1                                ...           3 months ago
  • 11.0.1-next.1                                ...           3 months ago
  • 11.0.1-canary.2                                ...           7 months ago
  • 11.0.0                                ...           9 months ago
  • 11.0.0-next.1                                ...           9 months ago
  • 11.0.0-next.0                                ...           9 months ago
  • 10.0.1                                ...           10 months ago
  • 6.1.0-next.2                                ...           10 months ago
  • 6.1.0-next.1                                ...           10 months ago
  • 6.0.2                                ...           a year ago
  • 6.0.2-next.0                                ...           a year ago
  • 6.0.1                                ...           a year ago
  • 6.0.1-next.2                                ...           a year ago
  • 6.0.1-next.1                                ...           a year ago
  • 6.0.1-canary.0                                ...           a year ago
  • 6.0.1-next.0                                ...           a year ago
  • 6.0.0                                ...           a year ago
  • 6.0.0-next.0                                ...           a year ago
  • 5.0.1                                ...           a year ago
  • 5.0.0                                ...           a year ago
  • 4.0.8                                ...           a year ago
  • 4.0.7                                ...           a year ago
  • 4.0.6                                ...           a year ago
  • 4.0.5                                ...           a year ago
  • 4.0.4                                ...           a year ago
  • 4.0.3                                ...           a year ago
  • 4.0.2                                ...           a year ago
  • 4.0.1                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.6.8-canary.9                                ...           a year ago
  • 3.6.7                                ...           a year ago
  • 3.6.6                                ...           a year ago
  • 3.6.5                                ...           a year ago
  • 3.6.4                                ...           a year ago
  • 3.6.3                                ...           a year ago
  • 3.6.0                                ...           2 years ago
  • 3.5.6                                ...           2 years ago
  • 3.5.5                                ...           2 years ago
  • 3.5.4                                ...           2 years ago
  • 3.5.3                                ...           2 years ago
  • 3.5.2                                ...           2 years ago
  • 3.5.1                                ...           2 years ago
  • 3.5.0                                ...           2 years ago
  • 3.4.0                                ...           2 years ago
  • 3.3.3                                ...           2 years ago
  • 3.3.2                                ...           2 years ago
  • 3.3.1                                ...           2 years ago
  • 3.3.0                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.12                                ...           2 years ago
  • 3.1.11                                ...           2 years ago
  • 3.1.10                                ...           2 years ago
  • 3.1.6-15                                ...           2 years ago
  • 3.1.6-14                                ...           2 years ago
  • 3.1.6-13                                ...           2 years ago
  • 3.1.6-9                                ...           2 years ago
  • 3.1.6-8                                ...           2 years ago
  • 3.1.6                                ...           2 years ago
  • 3.1.6-7                                ...           2 years ago
  • 3.1.6-1                                ...           2 years ago
  • 3.1.6-0                                ...           2 years ago
  • 3.1.5                                ...           2 years ago
  • 3.1.5-2                                ...           2 years ago
  • 3.1.5-1                                ...           2 years ago
  • 3.1.5-0                                ...           2 years ago
  • 3.1.4                                ...           2 years ago
  • 3.1.4-2                                ...           2 years ago
  • 3.1.4-1                                ...           2 years ago
  • 3.1.3                                ...           2 years ago
  • 3.1.2                                ...           2 years ago
  • 3.1.1                                ...           2 years ago
  • 3.0.8                                ...           2 years ago
  • 3.0.7                                ...           2 years ago
  • 3.0.6                                ...           2 years ago
  • 3.0.5                                ...           2 years ago
  • 3.0.4                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 2.2.9                                ...           2 years ago
  • 2.2.6                                ...           2 years ago
  • 2.2.5                                ...           2 years ago
  • 2.2.2                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.1-2                                ...           3 years ago
  • 1.0.1-1                                ...           3 years ago
  • 1.0.1-0                                ...           3 years ago
  • 1.0.1-0-beta.4584b5bb                                ...           3 years ago
  • 1.0.1-0-alpha.8857edee                                ...           3 years ago
  • 0.9.1                                ...           3 years ago
  • 0.9.0                                ...           3 years ago
  • 0.8.1                                ...           3 years ago
  • 0.8.0                                ...           3 years ago
  • 0.7.0                                ...           3 years ago
  • 0.6.1                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
  • 0.4.7                                ...           3 years ago
  • 0.4.6                                ...           3 years ago
  • 0.4.5                                ...           3 years ago
  • 0.4.4                                ...           3 years ago
  • 0.4.3                                ...           3 years ago
  • 0.4.2                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.5                                ...           3 years ago
  • 0.3.4                                ...           3 years ago
  • 0.3.3                                ...           3 years ago
  • 0.3.2                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |