UNPKG

701 BJavaScriptView Raw
1/**
2 * use `angular.forEach` instead of native `Array.prototype.forEach`
3 *
4 * You should use the angular.forEach method instead of the default JavaScript implementation [].forEach.
5 *
6 * @version 0.1.0
7 * @category angularWrapper
8 * @sinceAngularVersion 1.x
9 */
10'use strict';
11
12module.exports = {
13 meta: {
14 schema: []
15 },
16 create: function(context) {
17 return {
18 MemberExpression: function(node) {
19 if (node.object.type === 'Identifier' && node.object.name !== 'angular' && node.property.name === 'forEach') {
20 context.report(node, 'You should use the angular.forEach method', {});
21 }
22 }
23 };
24 }
25};