{"record":{"id":"42a5ffbbc128e9b3","repo":"Dogfalo/materialize","slug":"nouislider-animationduration-option-must-be-a-n","errorCode":null,"errorMessage":"noUiSlider: 'animationDuration' option must be a number.","messagePattern":"noUiSlider: 'animationDuration' option must be a number\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":537,"sourceCode":"        }\n    }\n\n    function testAnimate ( parsed, entry ) {\n\n        // Enforce 100% stepping within subranges.\n        parsed.animate = entry;\n\n        if ( typeof entry !== 'boolean' ){\n            throw new Error(\"noUiSlider: 'animate' option must be a boolean.\");\n        }\n    }\n\n    function testAnimationDuration ( parsed, entry ) {\n\n        parsed.animationDuration = entry;\n\n        if ( typeof entry !== 'number' ){\n            throw new Error(\"noUiSlider: 'animationDuration' option must be a number.\");\n        }\n    }\n\n    function testConnect ( parsed, entry ) {\n\n        var connect = [false];\n        var i;\n\n        // Map legacy options\n        if ( entry === 'lower' ) {\n            entry = [true, false];\n        }\n\n        else if ( entry === 'upper' ) {\n            entry = [false, true];\n        }\n\n        // Handle boolean options","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L519-L555","documentation":"Thrown by testAnimationDuration when the value is not typeof === 'number'. animationDuration sets the length of the animated movement in milliseconds; CSS-style duration strings or quoted numbers are not parsed.","triggerScenarios":"animationDuration: '300', animationDuration: '0.3s', animationDuration: true, animationDuration: null.","commonSituations":"Passing a CSS duration string, a quoted number from a config file, or a value with a unit suffix.","solutions":["Pass a bare number of milliseconds: animationDuration: 300.","Parse strings yourself: parseInt(raw, 10) after validation.","Omit the option for the default duration."],"exampleFix":"// before\nanimationDuration: \"300\"\n// after\nanimationDuration: 300","handlingStrategy":"validation","validationCode":"if (opts.animationDuration != null) {\n  const d = Number(opts.animationDuration);\n  if (typeof opts.animationDuration !== 'number' || !Number.isFinite(d)) throw new TypeError('animationDuration must be a number (ms)');\n  opts.animationDuration = d;\n}","typeGuard":"function isMs(v) { return typeof v === 'number' && Number.isFinite(v); }","tryCatchPattern":"try { noUiSlider.create(el, opts); }\ncatch (e) { if (/animationDuration' option must be a number/.test(e.message)) { opts.animationDuration = parseInt(opts.animationDuration, 10); /* retry */ } else throw e; }","preventionTips":["Convert CSS duration strings ('0.3s') to ms yourself.","Keep animationDuration as a number through your config pipeline.","Parse strings at the trust boundary, not at the slider."],"tags":["config","validation","animation-duration","type-coercion"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}