<commit_before>// # 1. Basic usage

// Grab the default formatic instance.
var formatic = require('formatic');

// Create a form.
var form = formatic({

  // Giving it some fields.
  fields: [
    {
      type: 'text',
      key: 'firstName'
    },
    {
      type: 'text',
      key: 'lastName'
    }
  ],

  // And a value.
  value: {
    firstName: 'Joe',
    lastName: 'Foo'
  }
});

// Get a React component.
var component = form.component({
  onChange: function (value) {
    // Do something interesting with the value.
    console.log(value);
  }
});

// Render the component to a DOM element.
formatic.render(component, document.body);<commit_msg>Fix basic example.<commit_after>// # 1. Basic usage

// Get the formatic class.
var Formatic = require('formatic');

// Create an element factory.
var Form = React.createFactory(Formatic);

// Create some fields.
var fields = [
{
  type: 'string',
  isSingleLine: true,
  key: 'firstName',
  label: '<NAME>'
},
{
  type: 'str',
  isSingleLine: true,
  key: 'lastName',
  label: '<NAME>'
}
];

// Render the form.
React.render(Form({
  fields: fields,
  onChange: function (newValue) {
    // Recieve new values.
    console.log(newValue);
  }
}), document.body);
{'fraction_non_alphanumeric': 0.15517241379310345, 'fraction_numerical': 0.0016420361247947454, 'mean_word_length': 2.7739938080495357, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7217727', 'n_tokens_mistral': 411, 'n_tokens_neox': 409, 'n_words': 119}