SIGN IN SIGN UP
chartjs / chart.js UNCLAIMED

Simple HTML5 Charts using the <canvas> tag

0 0 0 JavaScript

[fix] Handle non-primitives in isNumber (#12034)

While investigating https://github.com/chartjs/chartjs-plugin-zoom/issues/928, I found that `isNonPrimitive` will throw TypeError on a Moment.js object after it's passed through Chart.js's options proxy, because the object has its `Symbol.toPrimitive`, `toString`, and `valueOf` all set to null.

(See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion for background reading.)

Since isNumber appears to be a low-level function that can take any arbitrary input, it seems worth letting it handle this case.
J
Josh Kelley committed
2f425290ee077d9d013af77fa978d6b6d6885634
Parent: 370f6c3
Committed by GitHub <noreply@github.com> on 2/16/2025, 5:24:26 PM