//serializeArray.js
/*global adventurejs A*/
"use strict";
/**
* Convert an array of arbitrary strings to an array of IDs useable by game objects.
* <ul><li>convert ' ' to '_'</li>
* <li>convert ' and ' to '&'</li>
* <li>convert '.' to '$'</li>
* </ul>
* @method adventurejs#serializeArray
* @memberOf adventurejs
* @param {Array} array
* @returns {Array}
*/
adventurejs.serializeArray = function Adventurejs_serializeArray( array )
{
if( false === Array.isArray( array ) )
{
console.warn( "SerializeArray: " + array + " is not an array." );
return array;
}
for( var i = 0; i < array.length; i++ )
{
if( "string" === typeof array[i] )
{
array[i] = A.serialize( array[i] );
}
if( "object" === typeof array[i] )
{
// this should not happen
}
}
return array;
}