forked from cory/tildefriends
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) {
|
function decode(encoded) {
|
||||||
var result = "";
|
let result = "";
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (let i = 0; i < encoded.length; i++) {
|
||||||
var c = encoded[i];
|
let c = encoded[i];
|
||||||
if (c == "+") {
|
if (c == "+") {
|
||||||
result += " ";
|
result += " ";
|
||||||
} else if (c == "%") {
|
} else if (c == "%") {
|
||||||
@ -15,15 +15,15 @@ function decode(encoded) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function decodeForm(encoded, initial) {
|
function decodeForm(encoded, initial) {
|
||||||
var result = initial || {};
|
let result = initial || {};
|
||||||
if (encoded) {
|
if (encoded) {
|
||||||
encoded = encoded.trim();
|
encoded = encoded.trim();
|
||||||
var items = encoded.split('&');
|
let items = encoded.split('&');
|
||||||
for (var i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
var item = items[i];
|
let item = items[i];
|
||||||
var equals = item.indexOf('=');
|
let equals = item.indexOf('=');
|
||||||
var key = decode(item.slice(0, equals));
|
let key = decode(item.slice(0, equals));
|
||||||
var value = decode(item.slice(equals + 1));
|
let value = decode(item.slice(equals + 1));
|
||||||
result[key] = value;
|
result[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user