Instead of taking regex as a parameter we can rather define it inside the function in a switch-case flow or use if-elseif ladder which would determine the regex on the basis of type parameter :)
Instead of taking regex as a parameter we can rather define it inside the function in a switch-case…
Ashwin Pathak
1

Yeah but that wouldn’t be as modular as you would want to since you’re not injecting the dependencies, you’re defining them in the function, which would mean that everytime you want to have a new type you’d have to go and add another case or if.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.