<commit_before>JSON
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]

> Validates if a value is a parseable JSON string.


## Installation

``` bash
$ npm install validate.io-json
```

For use in the browser, use [browserify](https://github.com/substack/node-browserify).


## Usage

``` javascript
var isJSON = require( 'validate.io-json' );
```

#### isJSON( value )

Validates if a `value` is a parseable JSON `string`.

``` javascript
var value = '{"a":5}';

var bool = isJSON( value );
// returns true
```

## Notes

*	validates that the input `value` is a `string` literal. For all other inputs, the method returns `false`.
*	validates that a `string` begins with either `[` or `{` and ends with a corresponding `]` or `}`, respectively. Hence, the method will return `false` for the following `strings`, despite `JSON.parse` accepting their input:
	-	`'<number>'`; e.g., `'5'`
	-	`'<boolean>'`; e.g., `'true'`
	-	`'null'`
*	uses `JSON.parse` inside a `try/catch`. Hence, this method cannot be optimized by the compiler during runtime. Nevertheless, using this `function` is better than embedding a `try/catch` within a larger `function` which could be optimized in the absence of the `try/catch`.



## Examples

``` javascript
var isJSON = require( 'validate.io-json' );

console.log( isJSON( '{"a":5}' ) );
// returns true

console.log( isJSON( '{a":5}' ) );
// returns false
```

To run the example code from the top-level application directory,

``` bash
$ node ./examples/index.js
```


## Tests

### Unit

Unit tests use the [Mocha](http://mochajs.org) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:

``` bash
$ make test
```

All new feature development should have corresponding unit tests to validate correct functionality.


### Test Coverage

This repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

``` bash
$ make test-cov
```

Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,

``` bash
$ make view-cov
```


---
## License

[MIT license](http://opensource.org/licenses/MIT). 


## Copyright

Copyright &copy; 2015. <NAME>.


[npm-image]: http://img.shields.io/npm/v/validate.io-json.svg
[npm-url]: https://npmjs.org/package/validate.io-json

[travis-image]: http://img.shields.io/travis/validate-io/json/master.svg
[travis-url]: https://travis-ci.org/validate-io/json

[coveralls-image]: https://img.shields.io/coveralls/validate-io/json/master.svg
[coveralls-url]: https://coveralls.io/r/validate-io/json?branch=master

[dependencies-image]: http://img.shields.io/david/validate-io/json.svg
[dependencies-url]: https://david-dm.org/validate-io/json

[dev-dependencies-image]: http://img.shields.io/david/dev/validate-io/json.svg
[dev-dependencies-url]: https://david-dm.org/dev/validate-io/json

[github-issues-image]: http://img.shields.io/github/issues/validate-io/json.svg
[github-issues-url]: https://github.com/validate-io/json/issues
<commit_msg>[UPDATE] README.<commit_after>JSON
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]

> Validates if a value is a parseable JSON string.


## Installation

``` bash
$ npm install validate.io-json
```

For use in the browser, use [browserify](https://github.com/substack/node-browserify).


## Usage

``` javascript
var isJSON = require( 'validate.io-json' );
```

#### isJSON( value )

Validates if a `value` is a parseable JSON `string`.

``` javascript
var value = '{"a":5}';

var bool = isJSON( value );
// returns true
```

## Notes

*	validates that the input `value` is a `string` literal. For all other inputs, the method returns `false`.
*	validates that a `string` begins with either `[` or `{` and ends with a corresponding `]` or `}`, respectively. Hence, the method will return `false` for the following `strings`, despite `JSON.parse` accepting their input:
	-	`'<number>'`; e.g., `'5'`
	-	`'<boolean>'`; e.g., `'true'`
	-	`'null'`
*	uses `JSON.parse` inside a `try/catch`. Hence, this method cannot be optimized by the compiler during runtime. Nevertheless, using this `function` is better than embedding a `try/catch` within a larger `function` which could be optimized in the absence of a `try/catch`.



## Examples

``` javascript
var isJSON = require( 'validate.io-json' );

console.log( isJSON( '{"a":5}' ) );
// returns true

console.log( isJSON( '{a":5}' ) );
// returns false
```

To run the example code from the top-level application directory,

``` bash
$ node ./examples/index.js
```


## Tests

### Unit

Unit tests use the [Mocha](http://mochajs.org) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:

``` bash
$ make test
```

All new feature development should have corresponding unit tests to validate correct functionality.


### Test Coverage

This repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

``` bash
$ make test-cov
```

Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,

``` bash
$ make view-cov
```


---
## License

[MIT license](http://opensource.org/licenses/MIT). 


## Copyright

Copyright &copy; 2015. <NAME>.


[npm-image]: http://img.shields.io/npm/v/validate.io-json.svg
[npm-url]: https://npmjs.org/package/validate.io-json

[travis-image]: http://img.shields.io/travis/validate-io/json/master.svg
[travis-url]: https://travis-ci.org/validate-io/json

[coveralls-image]: https://img.shields.io/coveralls/validate-io/json/master.svg
[coveralls-url]: https://coveralls.io/r/validate-io/json?branch=master

[dependencies-image]: http://img.shields.io/david/validate-io/json.svg
[dependencies-url]: https://david-dm.org/validate-io/json

[dev-dependencies-image]: http://img.shields.io/david/dev/validate-io/json.svg
[dev-dependencies-url]: https://david-dm.org/dev/validate-io/json

[github-issues-image]: http://img.shields.io/github/issues/validate-io/json.svg
[github-issues-url]: https://github.com/validate-io/json/issues

{'fraction_non_alphanumeric': 0.16447666515632078, 'fraction_numerical': 0.0024165533907264765, 'mean_word_length': 4.3881204231082185, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 18, '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': '4165045', 'n_tokens_mistral': 2245, 'n_tokens_neox': 2107, 'n_words': 599}