<commit_before>defaultdict2
============

Returns a new dictionary-like object

Behaves __exactly__ like Python's [defaultdict](https://docs.python.org/3/library/collections.html#collections.defaultdict).

```
npm install --save defaultdict2
```

`defaultdict(default_factory, initial_dict)`

`default_factory`: value or function to be used for missing keys
`initial_dict`: (optional) dictionary to start with

See [this live demo](http://jsbin.com/fiqecu/edit?js,console) to check whether
your browser implements Proxies (Edge, FF, Chrome).

Getting started
---------------

The first argument is the value for missing keys - it can be a value or function like in Python.

```
var defaultdict = require('defaultdict2');
var d = defaultdict(0);
d.a++; 
d.b++;
console.log(d);
// { a: 1, b: 1 }
```

The same example using a function:

```
var d = defaultdict(()=>0);
d.a++; 
d.b++;<commit_msg>add link to blog post<commit_after>defaultdict2
============

Returns a new dictionary-like object

Behaves __exactly__ like Python's [defaultdict](https://docs.python.org/3/library/collections.html#collections.defaultdict).

```
npm install --save defaultdict2
```

`defaultdict(default_factory, initial_dict)`

`default_factory`: value or function to be used for missing keys
`initial_dict`: (optional) dictionary to start with

See [this live demo](http://jsbin.com/fiqecu/edit?js,console) to check whether
your browser implements Proxies (Edge, FF, Chrome).

Alternatively here's a [summary blog post](https://seb.wilzba.ch/b/2016/02/defaultdict-in-js) about defaultdict2.

Getting started
---------------

The first argument is the value for missing keys - it can be a value or function like in Python.

```
var defaultdict = require('defaultdict2');
var d = defaultdict(0);
d.a++; 
d.b++;
console.log(d);
// { a: 1, b: 1 }
```

The same example using a function:

```
var d = defaultdict(()=>0);
d.a++; 
d.b++;
{'fraction_non_alphanumeric': 0.15872184389732844, 'fraction_numerical': 0.012048192771084338, 'mean_word_length': 4.504322766570605, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 3, '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': '999613', 'n_tokens_mistral': 633, 'n_tokens_neox': 597, 'n_words': 195}