angularjs custom filter undefined checks

Add some undefined checks to your custom filters to prevent them breaking when bad/malformed/wrong type/data is passed to it.
For example

 

Expects users to be an array and current to be a number (string for loose comparisons).

 

 

If they were different format or undefined it would break horribly.
Different ways you can check.

 

Sam is a passionate web developer, online entrepreneur and investor. In his spare time he enjoys coding, playing chess and reading.

Leave a Reply

Your email address will not be published. Required fields are marked *