<commit_before>### Case: An extensible utility to convert, identify, and flip string case.

Download: [Case.min.js][prod]  or  [Case.js][dev]  
Bower: `bower install Case`  (note the big 'C')  
[NPM][npm]: `npm install case`  (little 'c' due to NPM restrictions)  

[prod]: https://raw.github.com/nbubna/Case/master/dist/Case.min.js
[dev]: https://raw.github.com/nbubna/Case/master/dist/Case.js
[npm]: https://npmjs.org/package/case

## Documentation
Each of the following functions will first "undo" previous case manipulations
before applying the desired case to the given string.

```javascript
Case.upper('foo_bar')                       -> 'FOO BAR'
Case.lower('fooBar')                        -> 'foo bar'
Case.snake('Foo bar!')                      -> 'foo_bar'
Case.squish('foo.bar')                      -> 'FooBar'
Case.camel('foo, bar')                      -> 'fooBar'
Case.constant('Foo-Bar')                    -> 'FOO_BAR'
Case.title('foo v. bar')                    -> 'Foo v. Bar'
Case.capital('foo_v_bar')                   -> 'Foo V Bar'
Case.sentence('"foo!" said bar', ['Bar'])   -> '"Foo!" said Bar'
```

`sentence(str, names)` accepts an array of proper names that should be capitalized,
regardless of location in the sentence.  This function is specialized, but useful
when dealing with input generated with capslock on (i.e. everything my grandma types).

There are three additional functions:
* `of(str)`: identifies the case of a string, returns undefined if it doesn't match a known type
* `flip(str)`: reverses the case of letters, no other changes
* `type(name, fn)`: extends Case with a new case type

```javascript
Case.of('foo')          -> 'lower'
Case.of('foo_bar')      -> 'snake'
Case.of('Foo v Bar')    -> 'title'
Case.of('foo_ Bar')     -> undefined

Case.flip('FlipMe')     -> 'fLIPmE'
Case.flip('TEST THIS!') -> 'test this!'

Case.type('bang', function(s) {
    return Case.upper(s, '!')+'!';
});
Case.bang('bang')       -> 'BANG!'
Case.of('TEST!THIS!')   -> 'bang'
```

Registering functions via `type()` means `Case.of` supports them automatically.

Oh, did you notice that little `Case.upper(s, '!')`?
Yeah, `upper()` and `lower()` accept a second "fill" argument
that will replace any characters which are not letters or numbers.
It's handy, sometimes. :)


## Release History
* 2013-06-10 v1.0.0 (public, initial)
* 2013-06-20 v1.0.1 (regex improvements)
* 2013-08-23 v1.0.3 (better support for Node, Component and AMD)

[v1.0.0]: https://github.com/nbubna/store/tree/1.0.0
[v1.0.1]: https://github.com/nbubna/store/tree/1.0.1
[v1.0.3]: https://github.com/nbubna/store/tree/1.0.3<commit_msg>Add a Bitdeli badge to README<commit_after>### Case: An extensible utility to convert, identify, and flip string case.

Download: [Case.min.js][prod]  or  [Case.js][dev]  
Bower: `bower install Case`  (note the big 'C')  
[NPM][npm]: `npm install case`  (little 'c' due to NPM restrictions)  

[prod]: https://raw.github.com/nbubna/Case/master/dist/Case.min.js
[dev]: https://raw.github.com/nbubna/Case/master/dist/Case.js
[npm]: https://npmjs.org/package/case

## Documentation
Each of the following functions will first "undo" previous case manipulations
before applying the desired case to the given string.

```javascript
Case.upper('foo_bar')                       -> 'FOO BAR'
Case.lower('fooBar')                        -> 'foo bar'
Case.snake('Foo bar!')                      -> 'foo_bar'
Case.squish('foo.bar')                      -> 'FooBar'
Case.camel('foo, bar')                      -> 'fooBar'
Case.constant('Foo-Bar')                    -> 'FOO_BAR'
Case.title('foo v. bar')                    -> 'Foo v. Bar'
Case.capital('foo_v_bar')                   -> 'Foo V Bar'
Case.sentence('"foo!" said bar', ['Bar'])   -> '"Foo!" said Bar'
```

`sentence(str, names)` accepts an array of proper names that should be capitalized,
regardless of location in the sentence.  This function is specialized, but useful
when dealing with input generated with capslock on (i.e. everything my grandma types).

There are three additional functions:
* `of(str)`: identifies the case of a string, returns undefined if it doesn't match a known type
* `flip(str)`: reverses the case of letters, no other changes
* `type(name, fn)`: extends Case with a new case type

```javascript
Case.of('foo')          -> 'lower'
Case.of('foo_bar')      -> 'snake'
Case.of('Foo v Bar')    -> 'title'
Case.of('foo_ Bar')     -> undefined

Case.flip('FlipMe')     -> 'fLIPmE'
Case.flip('TEST THIS!') -> 'test this!'

Case.type('bang', function(s) {
    return Case.upper(s, '!')+'!';
});
Case.bang('bang')       -> 'BANG!'
Case.of('TEST!THIS!')   -> 'bang'
```

Registering functions via `type()` means `Case.of` supports them automatically.

Oh, did you notice that little `Case.upper(s, '!')`?
Yeah, `upper()` and `lower()` accept a second "fill" argument
that will replace any characters which are not letters or numbers.
It's handy, sometimes. :)


## Release History
* 2013-06-10 v1.0.0 (public, initial)
* 2013-06-20 v1.0.1 (regex improvements)
* 2013-08-23 v1.0.3 (better support for Node, Component and AMD)

[v1.0.0]: https://github.com/nbubna/store/tree/1.0.0
[v1.0.1]: https://github.com/nbubna/store/tree/1.0.1
[v1.0.3]: https://github.com/nbubna/store/tree/1.0.3


[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/nbubna/case/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

{'fraction_non_alphanumeric': 0.16454293628808864, 'fraction_numerical': 0.019759926131117267, 'mean_word_length': 3.1186311787072243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1805590', 'n_tokens_mistral': 1913, 'n_tokens_neox': 1782, 'n_words': 530}