<commit_before># Numbrify

Numbrify is a small utility to convert _number-like strings_ in objects and arrays into actual numbers. If you've ever parsed a csv file and gotten a bunch of numbers-as-strings in your object, this can help with converting those back to numbers. It will leave things that don't look like numbers alone.

**NOTE:** Numbrify will also only do a shallow traversal of properties/elements in the collection. (though it should support deep traversal eventually).

# Usage

Include the script into your page. Possibly like so ```<script src="dist/numbrify.js" charset="utf-8"></script>```. ```src``` should point to wherever you downloaded the dist/numbrify.js file to.

Then call ```Numbrify``` with your collection. Here are some quick examples

```javascript
var data;
var result;

// Numbrify an array
data = ["123", "456", "789.2342", "foo"];
result = Numbrify(data);
// Result should equal: [123, 456, 789.2342, "foo"];

data = [
  {"name": "foo", "age": "42"},
  {"name": "bar", "age": "32"},
  {"name": "baz", "age": "22"}
]

// Numbrify an array of objects
// We use Array.map since numbrify wont deep traverse an
// array.
result = data.map(function(datum){
  return Numbrify(datum);
});
// Result should equal:
// [
//   {"name": "foo", "age": 42},
//   {"name": "foo", "age": 32},
//   {"name": "foo", "age": 22}
// ]

```

# Development

To build this locally, check out the repository, run ```npm install``` and then run ```npm build```. There is also an ```npm watch``` task that rebuilds on changes to the src file.

The source is written in ES6/ES2015 primarily to take advantage of ES6 modules and the convenient UMD build provided by babel.<commit_msg>Add more concise map syntax to readme<commit_after># Numbrify

Numbrify is a small utility to convert _number-like strings_ in objects and arrays into actual numbers. If you've ever parsed a csv file and gotten a bunch of numbers-as-strings in your object, this can help with converting those back to numbers. It will leave things that don't look like numbers alone.

**NOTE:** Numbrify will also only do a shallow traversal of properties/elements in the collection. (though it should support deep traversal eventually).

# Usage

Include the script into your page. Possibly like so ```<script src="dist/numbrify.js" charset="utf-8"></script>```. ```src``` should point to wherever you downloaded the dist/numbrify.js file to.

Then call ```Numbrify``` with your collection. Here are some quick examples

```javascript
var data;
var result;

// Numbrify an array
data = ["123", "456", "789.2342", "foo"];
result = Numbrify(data);
// Result should equal: [123, 456, 789.2342, "foo"];

data = [
  {"name": "foo", "age": "42"},
  {"name": "bar", "age": "32"},
  {"name": "baz", "age": "22"}
]

// Numbrify an array of objects
// We use Array.map since numbrify wont deep traverse an
// array.
result = data.map(function(datum){
  return Numbrify(datum);
});
// Result should equal:
// [
//   {"name": "foo", "age": 42},
//   {"name": "foo", "age": 32},
//   {"name": "foo", "age": 22}
// ]

// The above could also be written as
result = data.map(Numbrify);
```

# Development

To build this locally, check out the repository, run ```npm install``` and then run ```npm build```. There is also an ```npm watch``` task that rebuilds on changes to the src file.

The source is written in ES6/ES2015 primarily to take advantage of ES6 modules and the convenient UMD build provided by babel.
{'fraction_non_alphanumeric': 0.1418705035971223, 'fraction_numerical': 0.025899280575539568, 'mean_word_length': 4.104258443465492, 'pattern_counts': {'":': 24, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3966059', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1036, 'n_words': 476}