package com.exanimo.utils { /** * * Functions to be used with the Array.filter method. * * @see Array#filter() * * @author Matthew Tretter * @version 2008.07.30 * */ public class ArrayFilters { /** * * */ public function ArrayFilters() { throw new Error('ArrayFilters contains static utility methods and cannot be instantialized.'); } /** * * Determines whether an item is unique (i.e. exists in the Array more * only once.) When this function is passed to Array.filter, the result * is an array with all duplicate items removed. * * @param item * The item to check. * @param index * The position of the item in the Array. * @param array * The Array that contains the item. * @returns Boolean * True if the item exists in the Array only once; otherwise false. * */ public static function UNIQUE(item:*, index:int, array:Array):Boolean { return index == array.lastIndexOf(item); } } }