<commit_before># jsonapi-normalizer

[![CircleCI](https://circleci.com/gh/stevenpetryk/jsonapi-normalizer.svg?style=shield)](https://circleci.com/gh/stevenpetryk/jsonapi-normalizer)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)


A tool similar to [normalizr](https://github.com/paularmstrong/normalizr), but which leverages the
self-describing schemas present in [JSONAPI](http://jsonapi.org) to automatically normalize without
hand-written schema definitions.

## TL;DR

Turns this:

```js
{
  data: [{
    type: 'articles',
    id: '1',
    attributes: {
      title: 'title',
      body: 'body'
    },
    relationships: {
      author: {
        data: {
          id: '42',
          type: 'users'
        }
      }
    }
  }],

  included: [
    {
      type: 'users',
      id: '42',
      attributes: {
        name: 'John'
      }
    }
  ]
}
```

Into this:

```js
{
  result: {
    articles: ['1'],
    users: ['42']
  },
  entities: {<commit_msg>Make the README accurate<commit_after># jsonapi-normalizer

[![CircleCI](https://circleci.com/gh/stevenpetryk/jsonapi-normalizer.svg?style=shield)](https://circleci.com/gh/stevenpetryk/jsonapi-normalizer)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)


A tool similar to [normalizr](https://github.com/paularmstrong/normalizr), but which leverages the
self-describing schemas present in [JSONAPI](http://jsonapi.org) to automatically normalize without
hand-written schema definitions.

## TL;DR

Turns this:

```js
{
  data: [{
    type: 'articles',
    id: '1',
    attributes: {
      title: 'title',
      body: 'body'
    },
    relationships: {
      author: {
        data: {
          id: '42',
          type: 'users'
        }
      }
    }
  }],

  included: [
    {
      type: 'users',
      id: '42',
      attributes: {
        name: 'John'
      }
    }
  ]
}
```

Into this:

```js
{
  result: {
    articles: ['1']
  },
  entities: {
{'fraction_non_alphanumeric': 0.16634241245136186, 'fraction_numerical': 0.008754863813229572, 'mean_word_length': 2.647163120567376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '3034825', 'n_tokens_mistral': 745, 'n_tokens_neox': 713, 'n_words': 131}