Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Div
classapi-page

fluid.censorKeys(toCensor, keys)

Section
Column
width70%

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

Code Block
javascript
javascript
bgColorwhite
borderStylenonejavascript
fluid.censorKeys(toCensor, keys);

File name: Fluid.js

Parameters

Span
classborderless-table

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

Span
classborderless-table

Object

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

Column
width5%

Column

See Also


Example

Code Block
javascript
javascript
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

Code Block
javascript
javascript
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.