{"record":{"id":"1808c197ef60ef0a","repo":"Dogfalo/materialize","slug":"nouislider-step-is-not-numeric","errorCode":null,"errorMessage":"noUiSlider: 'step' is not numeric.","messagePattern":"noUiSlider: 'step' is not numeric\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":466,"sourceCode":"\t structured with an item for every option available. An\n\t option can be marked as required by setting the 'r' flag.\n\t The testing function is provided with three arguments:\n\t - The provided value for the option;\n\t - A reference to the options object;\n\t - The name for the option;\n\n\t The testing function returns false when an error is detected,\n\t or true when everything is OK. It can also modify the option\n\t object, to make sure all values can be correctly looped elsewhere. */\n\n    var defaultFormatter = { 'to': function( value ){\n        return value !== undefined && value.toFixed(2);\n    }, 'from': Number };\n\n    function testStep ( parsed, entry ) {\n\n        if ( !isNumeric( entry ) ) {\n            throw new Error(\"noUiSlider: 'step' is not numeric.\");\n        }\n\n        // The step option can still be used to set stepping\n        // for linear sliders. Overwritten if set in 'range'.\n        parsed.singleStep = entry;\n    }\n\n    function testRange ( parsed, entry ) {\n\n        // Filter incorrect input.\n        if ( typeof entry !== 'object' || Array.isArray(entry) ) {\n            throw new Error(\"noUiSlider: 'range' is not an object.\");\n        }\n\n        // Catch missing start or end.\n        if ( entry.min === undefined || entry.max === undefined ) {\n            throw new Error(\"noUiSlider: Missing 'min' or 'max' in 'range'.\");\n        }","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L448-L484","documentation":"Thrown by testStep when the 'step' option fails isNumeric. isNumeric requires typeof === 'number' and a finite non-NaN value, so numeric strings like '10' are rejected outright, not coerced. step defines the increment between reachable slider values on a linear range.","triggerScenarios":"step: '10', step: '5px', step: NaN, step: null (typeof null is 'object'), step: Infinity, or step: undefined passed explicitly.","commonSituations":"Reading step from element.dataset (always a string), from a query string or env var, or from JSON where the number was quoted. Carrying a CSS unit suffix.","solutions":["Pass a literal number: step: 10.","Coerce strings explicitly after an isFinite check: const s = Number(raw); if (!isFinite(s)) ... ; step: s.","Omit step entirely if the default (1) is acceptable."],"exampleFix":"// before\nstep: el.dataset.step\n// after\nstep: Number(el.dataset.step)","handlingStrategy":"validation","validationCode":"if (opts.step != null) {\n  const s = Number(opts.step);\n  if (typeof opts.step !== 'number' || !Number.isFinite(s)) throw new TypeError('step must be a finite number');\n  opts.step = s;\n}","typeGuard":"function isStep(v) { return typeof v === 'number' && Number.isFinite(v); }","tryCatchPattern":"try { noUiSlider.create(el, opts); }\ncatch (e) { if (/step' is not numeric/.test(e.message)) { opts.step = Number(opts.step); /* retry */ } else throw e; }","preventionTips":["Coerce dataset/query-string values with Number() before assignment.","Type the config object in TypeScript so string step values fail at compile time.","Strip unit suffixes ('px') at the boundary, not at the slider."],"tags":["config","validation","step","type-coercion"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}