var => let
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4158 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
0ba54c2b7b
commit
582ee0e4d7
20
core/form.js
20
core/form.js
@ -1,7 +1,7 @@
|
||||
function decode(encoded) {
|
||||
var result = "";
|
||||
for (var i = 0; i < encoded.length; i++) {
|
||||
var c = encoded[i];
|
||||
let result = "";
|
||||
for (let i = 0; i < encoded.length; i++) {
|
||||
let c = encoded[i];
|
||||
if (c == "+") {
|
||||
result += " ";
|
||||
} else if (c == "%") {
|
||||
@ -15,15 +15,15 @@ function decode(encoded) {
|
||||
}
|
||||
|
||||
function decodeForm(encoded, initial) {
|
||||
var result = initial || {};
|
||||
let result = initial || {};
|
||||
if (encoded) {
|
||||
encoded = encoded.trim();
|
||||
var items = encoded.split('&');
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i];
|
||||
var equals = item.indexOf('=');
|
||||
var key = decode(item.slice(0, equals));
|
||||
var value = decode(item.slice(equals + 1));
|
||||
let items = encoded.split('&');
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let item = items[i];
|
||||
let equals = item.indexOf('=');
|
||||
let key = decode(item.slice(0, equals));
|
||||
let value = decode(item.slice(equals + 1));
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user