was.js – Diff between revs 12 and 25
?pathlinks?
Rev 12 | Rev 25 | |||
---|---|---|---|---|
1 | /*************************************************************************/ |
1 | /*************************************************************************/ |
|
2 | /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ |
2 | /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ |
|
3 | /*************************************************************************/ |
3 | /*************************************************************************/ |
|
4 | function wasKeyValueObjectify(a) { |
4 | function wasKeyValueToObject(a) { |
|
5 | var o = {}; |
5 | var o = {}; |
|
6 | a.reduce(function(a, c, i) { |
6 | a.reduce(function(a, c, i) { |
|
7 | i = Math.floor(i / 2); |
7 | i = Math.floor(i / 2); |
|
8 | if (!a[i]) { |
8 | if (!a[i]) { |
|
9 | a[i] = []; |
9 | a[i] = []; |
|
10 | } |
10 | } |
|
11 | a[i].push(c); |
11 | a[i].push(c); |
|
12 | return a; |
12 | return a; |
|
13 | }, []).forEach(function(c, i, a) { |
13 | }, []).forEach(function(c, i, a) { |
|
14 | o[c[0]] = c[1]; |
14 | o[c[0]] = c[1]; |
|
15 | }, o); |
15 | }, o); |
|
16 | return o; |
16 | return o; |
|
17 | } |
17 | } |
|
- | 18 | |
||
- | 19 | /*************************************************************************/ |
||
- | 20 | /* Node.JS package export. */ |
||
- | 21 | /*************************************************************************/ |
||
- | 22 | module.exports.formats.kvp = { |
||
- | 23 | KeyValueToObject: wasKeyValueToObject |
||
- | 24 | }; |
||
18 | |
25 | |
|
19 | |
26 |
|
|
20 |
|
27 | |
|
21 | |
28 | |
|
22 | |
29 | |
|
23 | |
- |