Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Include Page
Infusion14:sneak peek warningInfusion14:
sneak peek warning

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


{section}
{column:width=70%}
Accepts an object to be censored, and a list of keys. The keys in the list will be removed from the object.
{code:javascript|borderStyle=none|bgColor=white}
fluid.censorKeys(toCensor, keys);
{code}
*File name:* {{Fluid.js

Parameters

}}

h2. Parameters

{span:class=borderless-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

Wiki Markup
{div
:class
=api-page
}

h1. fluid.censorKeys(toCensor, keys)
Section
Column
width70%
Code Block
javascriptjavascript
bgColorwhite
borderStylenone
Span
class

toCensor

keys

Span
classborderless-table

Object

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

Column
width5%
Column

See Also

Example

Code Blockjavascriptjavascript
. |

h2. Return Value
{span:class=borderless-table}
|*Object* | the censored object (the same object that was supplied as {{toCensor}}). |
{span}

{column}

{column:width=5%}
{column}

{column}
h3. See Also
* [fluid.each]
* [fluid.filterKeys]
* [fluid.transform]
{column}
{section}
----

h3. Example
{code:javascript}
fluid.each(addressArray, function (addr, index) {
    fluid.censorKeys(addr, ["name"]);
});
{code}
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
.
}}.

h3. Example: non-destructive

{code
:javascript
javascript
}
var anonymousAddresses = [];
fluid.each(addressArray, function (addr, index) {
    anonymousAddresses.push(fluid.censorKeys(fluid.copy(addr), ["name"]));
});
{code}
This example produces a new array of objects containing all but the "name" information in {{addressArray}}.

{div}