luajson icon indicating copy to clipboard operation
luajson copied to clipboard

Add option to ignore mismatched array lengths due to `null`/`undefined`.

Open rodovich opened this issue 7 years ago • 1 comments

This change adds an option array.ignoreLength which, when set to true, prevents adding n to tables decoded from arrays with null or undefined entries, such as "[null,42]".

This allows iterating over the tables using pairs without encountering a key/value pair that was not part of the JSON data.

The option defaults to false to preserve the current behavior for any existing callers.

rodovich avatar Mar 11 '18 18:03 rodovich

Codecov Report

Merging #42 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #42      +/-   ##
==========================================
+ Coverage   95.98%   95.98%   +<.01%     
==========================================
  Files          18       18              
  Lines        1021     1022       +1     
==========================================
+ Hits          980      981       +1     
  Misses         41       41
Impacted Files Coverage Δ
lua/json/decode/composite.lua 100% <100%> (ø) :arrow_up:
lua/json/decode/state.lua 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b5e3c9b...049dc46. Read the comment docs.

codecov-io avatar Mar 11 '18 18:03 codecov-io