Skip to content

Latest commit

 

History

History
32 lines (18 loc) · 927 Bytes

typecheck-number.md

File metadata and controls

32 lines (18 loc) · 927 Bytes

typecheck-number - use angular.isNumber instead of typeof comparisons

You should use the angular.isNumber method instead of the default JavaScript implementation (typeof 3 === "[object Number]").

Rule based on Angular 1.x

Examples

The following patterns are considered problems;

/*eslint angular/typecheck-number: 2*/

// invalid
typeof someNumber === 'number' // error: You should use the angular.isNumber method

The following patterns are not considered problems;

/*eslint angular/typecheck-number: 2*/

// valid
angular.isNumber(someNumber);

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links