<commit_before># jQuery.imposeFormat

ImposeFormat is a jQuery plugin which unobtrusively imposes a consistent format on form inputs. Specifically, it can rewrite user inputs for dates, times, phone numbers, or credit card numbers to a consistent format.

[Refer to the test fixtures for simple use cases demonstrating plugin behavior](https://github.com/aduth/jquery.imposeFormat/blob/master/test/spec/test.imposeFormat.js#L156-L193)

## Usage

Include jQuery and jquery.imposeFormat using script tags. Then, when the page is loaded, call imposeFormat on either individual inputs or an entire form.

### With individual inputs

Add `data-impose` attribute to each input field or specify a type when calling imposeFormat. Current default formats are **date**, **time**, **phone**, and **creditcard**. Optionally, when calling imposeFormat, you can include your own search and replace values.

```html
<input id="myTime" type="text" data-impose="time">
$(document).ready(function() {
  $('#myTime').imposeFormat();
  // OR: $('#myTime').imposeFormat({ type: 'time' });
  // OR: $('#myTime').imposeFormat({
  //       pattern: {
  //         search: /^(0\d|1[0-2]|\d):?([0-5]\d)[ ]*(AM?|PM?)$/i,
  //         replacement: '[0$1]{-2}:[0$2]{-2} [$3M]{2U}'
  //       }
  //     });
});
```
<commit_msg>Wrap example JavaScript with script tag<commit_after># jQuery.imposeFormat

ImposeFormat is a jQuery plugin which unobtrusively imposes a consistent format on form inputs. Specifically, it can rewrite user inputs for dates, times, phone numbers, or credit card numbers to a consistent format.

[Refer to the test fixtures for simple use cases demonstrating plugin behavior](https://github.com/aduth/jquery.imposeFormat/blob/master/test/spec/test.imposeFormat.js#L156-L193)

## Usage

Include jQuery and jquery.imposeFormat using script tags. Then, when the page is loaded, call imposeFormat on either individual inputs or an entire form.

### With individual inputs

Add `data-impose` attribute to each input field or specify a type when calling imposeFormat. Current default formats are **date**, **time**, **phone**, and **creditcard**. Optionally, when calling imposeFormat, you can include your own search and replace values.

```html
<input id="myTime" type="text" data-impose="time">
<script>
$(document).ready(function() {
  $('#myTime').imposeFormat();
  // OR: $('#myTime').imposeFormat({ type: 'time' });
  // OR: $('#myTime').imposeFormat({
  //       pattern: {
  //         search: /^(0\d|1[0-2]|\d):?([0-5]\d)[ ]*(AM?|PM?)$/i,
  //         replacement: '[0$1]{-2}:[0$2]{-2} [$3M]{2U}'
  //       }
  //     });
});
</script>
```

{'fraction_non_alphanumeric': 0.15713744793638773, 'fraction_numerical': 0.015145778114350625, 'mean_word_length': 4.1300970873786405, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '7401101', 'n_tokens_mistral': 818, 'n_tokens_neox': 783, 'n_words': 267}