/*
* Helma License Notice
*
* The contents of this file are subject to the Helma License
* Version 2.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://adele.helma.org/download/helma/license.txt
*
* Copyright 1998-2006 Helma Software. All Rights Reserved.
*
* $RCSfile: Array.js,v $
* $Author$
* $Revision$
* $Date$
*/
/**
* @fileoverview Adds useful methods to the JavaScript Array type.
*
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/core/Array.js')
*/
/**
* Check if this array contains a specific value.
* @external
* @memberof {Array}
* @param {Object} val the value to check
* @return {boolean} true if the value is contained
*/
Array.prototype.contains = function(val) {
return this.indexOf(val) > -1;
};
/**
* Retrieve the union set of a bunch of arrays
* @external
* @memberof {Array}
* @param {Array} array1,... the arrays to unify
* @return {Array} the union set
*/
Array.union = function() {
var result = [];
var map = {};
for (var i=0; i