was.js

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 43  →  ?path2? @ 44
/trunk/lib/formats/kvp/kvp.js
@@ -15,3 +15,25 @@
}, o);
return o;
}
 
/*************************************************************************/
/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
/*************************************************************************/
function wasKeyValueSet(k, v, data) {
return data.split('&')
.map(c => c.split('=')[0] === k ? `${k}=${v}` : c)
.concat(`${k}=${v}`)
.filter((e,i,s) => s.indexOf(e) === i)
.join('&')
}
 
 
/*************************************************************************/
/* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */
/*************************************************************************/
function wasKeyValueGet(k, data) {
return data.split('&').reduce((a, c) => {
var s = c.split('=')
return s[0] === k ? s[1] : a
}, '')
}