Tutorial: Recurring scrubbing

Recurring scrubbing

From tha layout of this project, if you need to scrub recurringly, you have to say it so!

    
    var Scrubber = require('object-scrubber');
        
    var testObj = { }
    var scrubber = new Scrubber()

    // here we set a processor to scrub in passin objects and arrays
    scrubber.when(function (x) {
        return typeof(x.value) === 'object'
    }, function (x) {
        // scrub the value (object or array)
        return x.scrub(x.value)
    });

    scrubber.when(function (xx) {
        return typeof(x.value) === 'string'
    }, function (x) {
        return x.value + '_processed!'
    });

    scrubber.scrub(testObj);