was.js – Diff between revs 45 and 53

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 45 Rev 53
Line 1... Line 1...
1 /*************************************************************************/ 1 /*************************************************************************/
2 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 2 /* Copyright (C) 2020 Wizardry and Steamworks - License: GNU GPLv3 */
3 /*************************************************************************/ 3 /*************************************************************************/
4 function wasKeyValueToObject(a) { 4 function wasKeyValueToObject(data) {
5 var o = {}; 5 var result = {};
6 a.reduce(function(a, c, i) { 6 data.split('&').forEach((kvp) => {
7 i = Math.floor(i / 2); 7 var kv = kvp.split('=')
8 if (!a[i]) { -  
9 a[i] = []; 8 .filter((kv) =>
10 } -  
11 a[i].push(c); -  
12 return a; -  
13 }, []).forEach(function(c, i, a) { 9 kv[0] !== 'undefined' && kv[1] !== 'undefined');
14 o[c[0]] = c[1]; 10 result[kv[0]] = kv[1];
-   11  
15 }, o); 12 });
16 return o; 13 return result;
17 } 14 }
Line 18... Line 15...
18   15  
19 /*************************************************************************/ 16 /*************************************************************************/
20 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ 17 /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */