luci-base: uci.js: fix option deletion quirks
Since option deletions are sent first, followed by ubus set commands,
a call sequence like:
uci.set('config', 'section', 'option', ['foo', 'bar'])
uci.set('config', 'section', 'option', ['foo'])
uci.unset('config', 'section', 'option')
... would result in the option retainining `foo` as value, instead of it
getting removed as one would expect.
Fix this issue by reverting the internal change state of the option before
storing the deletion.
While we're at it, also rework the internal tracking of deleted options to
not result in duplicate removal requests when the same option is unset
several times.
Finally change all `undefined` returns to `null` in order to comply with
the function documentation.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>