<commit_before>pouchdb.mapreduce.noeval
========================

MapReduce plugin for (PouchDB)[https://github.com/daleharvey] that does not use dynamic evaluation
of JavaScript (`eval()` or `new Function()`). Thus, it allows using PouchDB in environments with
strict policy against dynamic script evaluation, such as Chrome Packaged Apps or Adobe AIR runtime.

Note that this kind of treatment is not required for Chrome Extensions or (now deprecated) Chrome
Apps using manifest in version 1. For these kind of applications, the content security policy
can be (relaxed)[http://developer.chrome.com/extensions/contentSecurityPolicy.html#relaxing].

However, using `eval()` in new Chrome Apps would require putting the page using the script in a
sandbox, which in turns out to be very tricky, as sandboxed page doesn't have access to IndexedDB.
Using this plugin is effectively the only way to use PouchDB in a packaged app without putting the
original MapReduce plugin in a sandbox and setting a wrapper around it to communicate with the
rest of library via `window.postMessage()` calls.

Usage
-----

Make sure this script is loaded *after* PouchDB. Then, modify your view functions, so they use
`this.emit()` instead of `emit()` call.

Limitations
-----------

PouchDB also uses dynamic evaluation for constructing change filter functions, if you specify them
as members of a design document. This functionality is hard to override, as it's enclosed in
internal routines. Pass actual function implementations as `filter` arguments to be on the safe
side.<commit_msg>Corrected markdown in README<commit_after>pouchdb.mapreduce.noeval
========================

MapReduce plugin for [PouchDB](https://github.com/daleharvey) that does not use dynamic evaluation
of JavaScript (`eval()` or `new Function()`). Thus, it allows using PouchDB in environments with
strict policy against dynamic script evaluation, such as Chrome Packaged Apps or Adobe AIR runtime.

Note that this kind of treatment is not required for Chrome Extensions or (now deprecated) Chrome
Apps using manifest in version 1. For these kind of applications, the content security policy
can be [relaxed](http://developer.chrome.com/extensions/contentSecurityPolicy.html#relaxing).

However, using `eval()` in new Chrome Apps would require putting the page using the script in a
sandbox, which in turns out to be very tricky, as sandboxed page doesn't have access to IndexedDB.
Using this plugin is effectively the only way to use PouchDB in a packaged app without putting the
original MapReduce plugin in a sandbox and setting a wrapper around it to communicate with the
rest of library via `window.postMessage()` calls.

Usage
-----

Make sure this script is loaded *after* PouchDB. Then, modify your view functions, so they use
`this.emit()` instead of `emit()` call.

Limitations
-----------

PouchDB also uses dynamic evaluation for constructing change filter functions, if you specify them
as members of a design document. This functionality is hard to override, as it's enclosed in
internal routines. Pass actual function implementations as `filter` arguments to be on the safe
side.
{'fraction_non_alphanumeric': 0.07865524896923565, 'fraction_numerical': 0.0006343165239454488, 'mean_word_length': 4.862453531598513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1609114', 'n_tokens_mistral': 793, 'n_tokens_neox': 739, 'n_words': 434}