-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
Describe the bug
Using Array.filter with isHexColor on an array of colour strings now throws an exception.
The exception is from the merge.js file because the new options object for isHexColor method is assumed to be param index 1, and is assumed to be an object. Array.filter automatically passes the current array index as param 1, which is not an object and which therefore cannot be merged with the default options.
Examples
The following will throw an exception:
import isHexColor from "validator/es/lib/isHexColor";
const validColors = ["#000000", "#FFFFFF"].filter(isHexColor);
Additional context
Validator version: 13.15.26
Pull request introducing the bug: validatorjs/validator.js/pull/2535
All node versions
All platforms
Reactions are currently unavailable