lib: reduce overhead of validateObject
Reducing the number of comparisons and allocations when using validateObject
.
confidence improvement accuracy (*) (**) (***)
validators/validate-object.js objectToTest='array' n=100000 *** 28696.95 % ±1448.43% ±1952.07% ±2591.59%
validators/validate-object.js objectToTest='function' n=100000 *** 28553.34 % ±1501.99% ±2024.25% ±2687.42%
validators/validate-object.js objectToTest='null' n=100000 *** 25157.86 % ±1483.43% ±1999.24% ±2654.21%
validators/validate-object.js objectToTest='object' n=100000 *** 60.87 % ±10.64% ±14.24% ±18.70%
Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 4 comparisons, you can thus
expect the following amount of false-positive results:
0.20 false positives, when considering a 5% risk acceptance (*, **, ***),
0.04 false positives, when considering a 1% risk acceptance (**, ***),
0.00 false positives, when considering a 0.1% risk acceptance (***)