<commit_before># base62.js

[![Build Status](https://travis-ci.org/sasaplus1/base62.js.png)](https://travis-ci.org/sasaplus1/base62.js)
[![Dependency Status](https://gemnasium.com/sasaplus1/base62.js.png)](https://gemnasium.com/sasaplus1/base62.js)

base62 encode/decode library

## Installation

### npm

```sh
$ npm install base62.js
```

### bower

```sh
$ bower install base62
```

## Usage

### node.js

```js
var base62 = require('base62.js');
```

### browser

```html
<script src="base62.min.js"></script>
```

```js
base62.encode(39134);  // "abc"
base62.decode('abc');  // 39134
```

```js
var b62 = base62.createConverter(
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');

b62.encode(39134);  // "ABC"
b62.decode('ABC');  // 39134
```

## Functions

### createConverter([table])

* `table` string - base62 table string
* `return` Base62 - Base62 instance

return Base62 instance.

use default table if parameter is empty.
default table is `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`.

throw TypeError if table is not a string.

throw Error if table is not 62 length.

### Base62#decode(str)

* `str` string - base62 string
* `return` number - decoded number

convert from base62 string to integer.

throw TypeError if str is not a string.

throw Error if str is unsupported format.
str should match to `/^-?[\da-zA-Z]+$/`.

### Base62#encode(num)

* `num` number - integer
* `return` string - encoded string

convert from integer to base62 string.

throw TypeError if num is not a number.

throw Error if num is not an integer.
num is not a finite number (ex. NaN, Infinity or -Infinity).
or num is floating-point number.

## Test

```sh
$ npm install
$ npm test
```

## License

The MIT License. Please see LICENSE file.<commit_msg>appended how to test for browser<commit_after># base62.js

[![Build Status](https://travis-ci.org/sasaplus1/base62.js.png)](https://travis-ci.org/sasaplus1/base62.js)
[![Dependency Status](https://gemnasium.com/sasaplus1/base62.js.png)](https://gemnasium.com/sasaplus1/base62.js)

base62 encode/decode library

## Installation

### npm

```sh
$ npm install base62.js
```

### bower

```sh
$ bower install base62
```

## Usage

### node.js

```js
var base62 = require('base62.js');
```

### browser

```html
<script src="base62.min.js"></script>
```

```js
base62.encode(39134);  // "abc"
base62.decode('abc');  // 39134
```

```js
var b62 = base62.createConverter(
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');

b62.encode(39134);  // "ABC"
b62.decode('ABC');  // 39134
```

## Functions

### createConverter([table])

* `table` string - base62 table string
* `return` Base62 - Base62 instance

return Base62 instance.

use default table if parameter is empty.
default table is `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`.

throw TypeError if table is not a string.

throw Error if table is not 62 length.

### Base62#decode(str)

* `str` string - base62 string
* `return` number - decoded number

convert from base62 string to integer.

throw TypeError if str is not a string.

throw Error if str is unsupported format.
str should match to `/^-?[\da-zA-Z]+$/`.

### Base62#encode(num)

* `num` number - integer
* `return` string - encoded string

convert from integer to base62 string.

throw TypeError if num is not a number.

throw Error if num is not an integer.
num is not a finite number (ex. NaN, Infinity or -Infinity).
or num is floating-point number.

## Test

### test for node.js

```sh
$ npm install
$ npm test
```

### test for browser

```sh
$ npm install
$ npm run-script bower
$ npm run-script testem
```

## License

The MIT License. Please see LICENSE file.
{'fraction_non_alphanumeric': 0.14667026152601778, 'fraction_numerical': 0.05284443246157994, 'mean_word_length': 4.145631067961165, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3535724', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1305, 'n_words': 379}