<commit_before>[![GitHub version](https://badge.fury.io/gh/andretf%2Fnanofeed.svg)](https://badge.fury.io/gh/andretf%2Fnanofeed)
[![Code Climate](https://codeclimate.com/github/andretf/nanofeed/badges/gpa.svg)](https://codeclimate.com/github/andretf/nanofeed)
[![Build Status](https://travis-ci.org/andretf/nanofeed.svg?branch=master)](https://travis-ci.org/andretf/nanofeed)
[![Test Coverage](https://codeclimate.com/github/andretf/nanofeed/badges/coverage.svg)](https://codeclimate.com/github/andretf/nanofeed/coverage)
# nanofeed
#### Tiny RSS feed parser built in JavaScript.

No dependencies.<br>
Asynchronous requests.<br>
Multiple feeds sources.<br>
Multiple independent successive calls.

##Installation

    bower install nanofeed
    npm install nanofeed

##Examples
```javascript
// minimal
nanofeed.fetch(url, function(items) {
  console.log(items);
});

// with options
nanofeed.fetch(url, {
    fields: ['title', 'date'],
    qty: 15
  },
  function(items){
    items.forEach(function(x){
      var newItemHtml = '<li>' + items.title + ' - ' + item.date + '</li>';
      document.getElementById('feed').innerHTML += newItemHtml;
    });
  }
);

// multiple feed sources
nanofeed.fetch([socialFeedUrl, newsFeedUrl], addFeedItems)

// successive calls
nanofeed.fetch([socialFeedUrl, newsFeedUrl], addFeedItems)
        .fetch(weatherFeedUrl, addWeatherFeedItems);
```

##Documentation
####`nanofeed.fetch(feed_url, [options,] success_callback);`

- ####feed_url<br>
Absolute URL(s) of the RSS feed(s).<br>
*required*<br>
**`string`** | **`string array`**

- ####options<br>
Options about format of result returned from feed sources.<br>
*optional*<br>
**`object`**<br>

  - **fields**<br>
  Fields to be returned from feed source(s).<br>
  *optional* <br>
  **`string array`**<br>
  default: `['title', 'link']`<br>
  accepted values: `title` | `link` | `date` | `description`.

  - **qty**<br>
  Quantity of feed entries to return.<br><commit_msg>updated README with #3 changes<commit_after>[![GitHub version](https://badge.fury.io/gh/andretf%2Fnanofeed.svg)](https://badge.fury.io/gh/andretf%2Fnanofeed)
[![Code Climate](https://codeclimate.com/github/andretf/nanofeed/badges/gpa.svg)](https://codeclimate.com/github/andretf/nanofeed)
[![Build Status](https://travis-ci.org/andretf/nanofeed.svg?branch=master)](https://travis-ci.org/andretf/nanofeed)
[![Test Coverage](https://codeclimate.com/github/andretf/nanofeed/badges/coverage.svg)](https://codeclimate.com/github/andretf/nanofeed/coverage)
# nanofeed
#### Tiny RSS feed parser built in JavaScript.

No dependencies.<br>
Asynchronous requests.<br>
Multiple feeds sources.<br>
Multiple independent successive calls.

##Installation

    bower install nanofeed
    npm install nanofeed

##Examples
```
// minimal
nanofeed.fetch(url, function(items) {
  console.log(items);
});

// Multiple feed sources
nanofeed.fetch([socialFeedUrl, newsFeedUrl], addFeedItems)

// Successive calls
nanofeed.fetch([socialFeedUrl, newsFeedUrl], addFeedItems)
        .fetch(weatherFeedUrl, addWeatherFeedItems);

// Callback function receive array of items retrieved from the feed
function callback(items){
  items.forEach(function(x){
    var newItemHtml = '<li>' + items.title + ' - ' + item.date + '</li>';
    document.getElementById('feed').innerHTML += newItemHtml;
  });
}

// Setting options for a function call
nanofeed.fetch(url, {
    fields: ['title', 'date'],
    qty: 15
  },
  callback
);

// or globally for all function calls
nanofeed.options = {
    fields: ['title', 'date'],
    qty: 15
};
nanofeed.fetch(url, callback);
nanofeed.fetch(weatherFeedUrl, addWeatherFeedItems);
```

##Documentation
####`nanofeed.fetch(feed_url, [options,] success_callback);`

- ####feed_url<br>
Absolute URL(s) of the RSS feed(s).<br>
*required*<br>
**`string`** | **`string array`**

- ####options<br>
Options about format of result returned from feed sources.<br>
*optional*<br>
**`object`**<br>

  - **fields**<br>
  Fields to be returned from feed source(s).<br>
  *optional* <br>
  **`string array`**<br>
  default: `['title', 'link']`<br>
  accepted values: `title` | `link` | `date` | `description`.

  - **qty**<br>
  Quantity of feed entries to return.<br>
{'fraction_non_alphanumeric': 0.17832582404553, 'fraction_numerical': 0.002608489447474508, 'mean_word_length': 4.966053748231966, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '582245', 'n_tokens_mistral': 1502, 'n_tokens_neox': 1446, 'n_words': 286}