Documentation for a historical release of Infusion: 1.4
Please view the Infusion Documentation site for the latest documentation, or the Infusion 1.3. Documentation for the previous release.
If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

fluid.censorKeys

This functionality is Sneak Peek status. This means that the APIs may change. We welcome your feedback, ideas, and code, but please use caution if you use this new functionality.

fluid.censorKeys(toCensor, keys)

Accepts an object to be censored, and a list of keys. The keys in the list will be removed from the object.

fluid.censorKeys(toCensor, keys);

File name: Fluid.js

Parameters

toCensor (Arrayable or Object) The object to be censored - this will be modified by the operation.
keys (Array of strings) The list of keys to remove from the object.

Return Value

Object the censored object (the same object that was supplied as toCensor).


Example

fluid.each(addressArray, function (addr, index) {
    fluid.censorKeys(addr, ["name"]);
});

This example processes an array of address objects and makes it "anonymous" it by stripping out the name fields. Note that this example is destructive: It directly modifies the original objects in addressArray.

Example: non-destructive

var anonymousAddresses = [];
fluid.each(addressArray, function (addr, index) {
    anonymousAddresses.push(fluid.censorKeys(fluid.copy(addr), ["name"]));
});

This example produces a new array of objects containing all but the "name" information in addressArray.