Author: ygrego Date: 2015-03-02 09:05:34 +0000 (Mon, 02 Mar 2015) New Revision: 897 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/897 Log: The index of a array is always positive so use of function "Math.abs" into method "findChannel". Because to find a channel the index is subject to a calculation in order to always loop on the list of channels. Modified: oipf/js/utils/ChannelTools.js Modified: oipf/js/utils/ChannelTools.js =================================================================== --- oipf/js/utils/ChannelTools.js 2015-03-02 08:49:32 UTC (rev 896) +++ oipf/js/utils/ChannelTools.js 2015-03-02 09:05:34 UTC (rev 897) @@ -7,10 +7,9 @@ init: function() { }, findChannel: function(channelCollection, channel, step) { - for (var keys = Object.keys(channelCollection) in channelCollection) { if (channelCollection[keys] == channel) { - return channelCollection[(keys % channelCollection.length) + step]; + return channelCollection[Math.abs((keys%(channelCollection.length))+step)]; } } return null;
participants (1)
-
ygregoï¼ users.nuiton.org