title: why do I get ..is not a function?
body: <p>I am trying to create an angular service but getting an error. This is the service:</p>
  
  <pre><code>var app = angular.module('plunker', []);
  
  // Filter Service that returns records with crdamt positive:
  app.factory('FilterService', function() {
    return function(d) {
      var filteredData = [];
      console.log(d);
      d.forEach(function(item) 
      {
        if (item.cramt &gt; 0) {
            filteredData.push(item);
        }
      });
      return filteredData;
    }
  });
  </code></pre>
  
  <p>In my unit test however we get:</p>
  
  <pre><code>  it('should return transactions where credit is positive', function() {
      var jsonData = {
        "transactions": [{
          "date": "1/1/2000",
          "desc": "Purchase",
          "cramt": 50,
          "dbamt": 0
        }, {
          "date": "1/1/2002",
          "desc": "Transaction",
          "cramt": 110,
          "dbamt": 10
        }]
      };
  
      var filteredRecords = FilterService(jsonData);
      expect(filteredRecords).toEqual({
        "date": "1/1/2000",
        "desc": "Purchase",
        "cramt": 50,
        "dbamt": 0
      });
    });
  </code></pre>
  
  <p>Why do I get an error:</p>
  
  <pre><code>TypeError: d.forEach is not a function
  </code></pre>
  
  <p>plunkr:<a href="http://plnkr.co/edit/jdg0wEj1zSDTbqojBAoc?p=preview" rel="nofollow">http://plnkr.co/edit/jdg0wEj1zSDTbqojBAoc?p=preview</a></p>