<commit_before># Hulk

Hulk is an in-browser JSON editor.

## Usage

    $.hulk('#selector', {'foo': 'bar'}, function(data) {
        console.log("Here's the updated data: " + data);
    });

Will insert the JSON editor into the div with id "selector". Generally ID's are
preferred.

The third argument is a callback that will execute when the user presses "Save".
Alternatively, you can retrieve the state of the world at any point by calling:

    $.hulkSmash('#selector');

There are two CSS files, `hulk.css` and `hulk-colors.css`, which make the layout
much more readable. Of course, you are happy to style the inputs however you
desire.

## Argument documentation

The `$.hulk` function takes the following arguments in this order:

- **selector (string)** - Any valid jQuery selector. The input nodes will be
inserted into the DOM based on the selector you give. This argument is required.

- **data (object)** - Any valid JSON object. This will be serialized and splayed
  into the DOM. This argument is required.

- **callback (function)** - When the user presses "Save" hulk will re-serialize
  the data and pass it as an argument to the function you provide. This argument
  is optional.

- **options (object)** - A dictionary of optional settings for hulk. This
  argument is optional.

## Optional settings

- **separator (string)** - Define a custom separator between keys and values. By
default, the separator looks like "=>".

- **permissions (string)** - Define how customizable and editable the custom JSON
dictionary is. For example, you may only want to update existing values, not add
new objects. This takes a few different values.

    - "all" - allow the user to edit everything. This is the default.
    - "values-only" - only allow the user to edit the leaf nodes
    - "no-append" - User can edit keys and values, but can't add or delete nodes
      from the object.

- **emptyString (string)** - Serialize an empty text input field back
  into JSON using the empty string ("") instead of null. Defaults to `false`.

## Installation

1. Include the jQuery source on your page

2. Include the `hulk` plugin.<commit_msg>Add notes section to README<commit_after># Hulk

Hulk is an in-browser JSON editor.

## Usage

    $.hulk('#selector', {'foo': 'bar'}, function(data) {
        console.log("Here's the updated data: " + data);
    });

Will insert the JSON editor into the div with id "selector". Generally ID's are
preferred.

The third argument is a callback that will execute when the user presses "Save".
Alternatively, you can retrieve the state of the world at any point by calling:

    $.hulkSmash('#selector');

There are two CSS files, `hulk.css` and `hulk-colors.css`, which make the layout
much more readable. Of course, you are happy to style the inputs however you
desire.

## Argument documentation

The `$.hulk` function takes the following arguments in this order:

- **selector (string)** - Any valid jQuery selector. The input nodes will be
inserted into the DOM based on the selector you give. This argument is required.

- **data (object)** - Any valid JSON object. This will be serialized and splayed
  into the DOM. This argument is required.

- **callback (function)** - When the user presses "Save" hulk will re-serialize
  the data and pass it as an argument to the function you provide. This argument
  is optional.

- **options (object)** - A dictionary of optional settings for hulk. This
  argument is optional.

## Optional settings

- **separator (string)** - Define a custom separator between keys and values. By
default, the separator is "=>".

- **permissions (string)** - Define how customizable and editable the custom JSON
dictionary is. For example, you may only want to update existing values, not add
new objects. This takes a few different values.

    - "all" - allow the user to edit everything. This is the default.
    - "values-only" - only allow the user to edit the leaf nodes
    - "no-append" - User can edit keys and values, but can't add or delete nodes
      from the object.

- **emptyString (string)** - Serialize an empty text input field back into JSON
using the empty string (`""`) instead of `null`. Defaults to `false`.

## Notes

- Javascript objects do not maintain a sorted order. This means, when
  serializing an object from HTML to JSON, the keys will not be sorted. To
  maintain some semblance of order, keys are presented on the page in
  alphabetical order when serializing from JSON to HTML (this is something we
  can control). Consider sorting keys once they are received on the server or
  whichever sane language is dealing with your new JSON object.

- There is inherent uncertainty in using text inputs for data entry. Does the
  entry "5.5" represent the number 5.5 or the string "5.5"? In this case we do
  some basic parsing.

    - if the value looks like a number, it's converted to a number
    - if the value looks like a boolean ("true" or "false"), it's converted to a boolean
    - if the value is empty, or the word "null", it's converted to the null value.

## Installation

1. Include the jQuery source on your page

2. Include the `hulk` plugin.
{'fraction_non_alphanumeric': 0.08326878388845856, 'fraction_numerical': 0.0019364833462432224, 'mean_word_length': 3.574844995571302, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1709598', 'n_tokens_mistral': 1411, 'n_tokens_neox': 1335, 'n_words': 762}