fluid.remove_if
fluid.remove_if(source, fn)
Scan through a list of objects, removing those which match a predicate. Similar to jQuery.grep, only acts on the list in-place by removal, rather than by creating a new list by inclusion.
fluid.remove_if(source, fn);
File name: Fluid.js
Parameters
source |
(Array or Object) The list of objects to be scanned over. |
fn |
(Type) A predicate function determining whether an element should be removed. This accepts the standard signature (object, index) and returns a "truthy" result to indicate that the supplied object should be removed from the list. |
Return Value
(Array or Object) | The source , transformed by the operation of removing the matched elements. The supplied list is modified by this operation.. |
See Also
Example
fluid.remove_if(listOfPermissions, function (permItem) { return !permManager.resolve(permItem); });
In this example, each object in a list of permission objects is examined using a function called permManager.resolve()
. If this function fails to resolve the item, it will be removed from the list.