Include Page |
---|
| Infusion14:sneak peek warningInfusion14: |
---|
| sneak peek warning |
---|
|
Wiki Markup |
---|
{div |
:class | =api-page | }
h1. fluid.censorKeys(toCensor, keys) Section |
---|
Column |
---|
|
|
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 | bgColor | white |
---|
borderStyle | none |
---|
{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
Span |
---|
class | }}
h2. Parameters
{span:class=borderless-table
toCensor
| }
|*{{toCensor}}*| (Arrayable or Object) The object to be censored - this will be modified by the operation.
keys
| |
|*{{keys}}*| (Array of strings) The list of keys to remove from the object
. Return Value
Span |
---|
|
Object | the censored object (the same object that was supplied as toCensor ). |
Column |
---|
|
Example
Code Block |
---|
javascript | javascript | . |
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}