From 8c1c6c7da5bb109b5164e8339ee59641dfb67056 Mon Sep 17 00:00:00 2001 From: Erik O'Leary <969938+onionhammer@users.noreply.github.com> Date: Thu, 19 Sep 2019 10:34:55 -0500 Subject: [PATCH] Set value of empty checkbox to 'false' rather than quote Most API input validation would prefer a `true` or `false` to empty quotes for checkboxes --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7a1f11d..fb2455c 100644 --- a/index.js +++ b/index.js @@ -63,8 +63,8 @@ function serialize(form, options) { // If we want empty elements if (options.empty) { // for checkbox - if (element.type === 'checkbox' && !element.checked) { - val = ''; + if (element.type === 'checkbox') { + val = element.checked; } // for radio