<commit_before>#String Validator
A library of string validators based on validator.js.  Created to be used with [node-schema](https://github.com/theadam/node-schema).

###Installation
`npm install string-validator`

###Description
This library reformats each function from validator.js to create easily reusable validators.
```javascript
  var str = require('string-validator')

  var containsValid = str.contains('Valid');
  containsValid('Validate'); //=> true
```
The result of each string-validator function is a function that accepts the value to test and
returns true or false.  This allows the resulting function to be used in places where a
function that just takes a value is expected.  This cannot be done with validator.js due to the extra
arguments in some functions.

Example Usage:
```javascript
var _ = require('lodash');
var str = require('string-validator');

var strings = ['this', 'is', 'a', 'nice', 'way', 'to', 'filter'];

var filterFunction = str.isLength(3);

_.filter(strings, filterFunction); //=> ['this', 'nice', 'way', 'filter']
```


### Validators

- **equals(comparison)** - check if the string matches the comparison.
- **contains(seed)** - check if the string contains the seed.
- **matches(pattern [, modifiers])** - check if string matches the pattern. Either `matches('foo', /foo/i)` or `matches('foo', 'foo', 'i')`.
- **isEmail()** - check if the string is an email.
- **isURL([options])** - check if the string is an URL. `options` is an object which defaults to `{ protocols: ['http','https','ftp'], require_tld: true, require_protocol: false, allow_underscores: false }`.
- **isIP([version])** - check if the string is an IP (version 4 or 6).
- **isAlpha()** - check if the string contains only letters (a-zA-Z).
- **isNumeric()** - check if the string contains only numbers.
- **isAlphanumeric()** - check if the string contains only letters and numbers.
- **isBase64()** - check if a string is base64 encoded.
- **isHexadecimal()** - check if the string is a hexadecimal number.
- **isHexColor()** - check if the string is a hexadecimal color.
- **isLowercase()** - check if the string is lowercase.
- **isUppercase()** - check if the string is uppercase.
- **isInt()** - check if the string is an integer.
- **isFloat()** - check if the string is a float.
- **isDivisibleBy(number)** - check if the string is a number that's divisible by another.
- **isNull()** - check if the string is null.
- **isLength(min [, max])** - check if the string's length falls in a range. Note: this function takes into account surrogate pairs.
- **isByteLength(min [, max])** - check if the string's length (in bytes) falls in a range.
- **isUUID([version])** - check if the string is a UUID (version 3, 4 or 5).
- **isDate()** - check if the string is a date.
- **isAfter([date])** - check if the string is a date that's after the specified date (defaults to now).<commit_msg>added links to validator.js in readme<commit_after>#String Validator
A library of string validators based on [validator.js](https://github.com/chriso/validator.js).  Created to be used with [node-schema](https://github.com/theadam/node-schema).

###Installation
`npm install string-validator`

###Description
This library reformats each function from [validator.js](https://github.com/chriso/validator.js) to create easily reusable validators.
```javascript
  var str = require('string-validator')

  var containsValid = str.contains('Valid');
  containsValid('Validate'); //=> true
```
The result of each string-validator function is a function that accepts the value to test and
returns true or false.  This allows the resulting function to be used in places where a
function that just takes a value is expected.  This cannot be done with [validator.js](https://github.com/chriso/validator.js) due to the extra
arguments in some functions.

Example Usage:
```javascript
var _ = require('lodash');
var str = require('string-validator');

var strings = ['this', 'is', 'a', 'nice', 'way', 'to', 'filter'];

var filterFunction = str.isLength(3);

_.filter(strings, filterFunction); //=> ['this', 'nice', 'way', 'filter']
```


### Validators

- **equals(comparison)** - check if the string matches the comparison.
- **contains(seed)** - check if the string contains the seed.
- **matches(pattern [, modifiers])** - check if string matches the pattern. Either `matches(/foo/i)` or `matches(foo', 'i')`.
- **isEmail()** - check if the string is an email.
- **isURL([options])** - check if the string is an URL. `options` is an object which defaults to `{ protocols: ['http','https','ftp'], require_tld: true, require_protocol: false, allow_underscores: false }`.
- **isIP([version])** - check if the string is an IP (version 4 or 6).
- **isAlpha()** - check if the string contains only letters (a-zA-Z).
- **isNumeric()** - check if the string contains only numbers.
- **isAlphanumeric()** - check if the string contains only letters and numbers.
- **isBase64()** - check if a string is base64 encoded.
- **isHexadecimal()** - check if the string is a hexadecimal number.
- **isHexColor()** - check if the string is a hexadecimal color.
- **isLowercase()** - check if the string is lowercase.
- **isUppercase()** - check if the string is uppercase.
- **isInt()** - check if the string is an integer.
- **isFloat()** - check if the string is a float.
- **isDivisibleBy(number)** - check if the string is a number that's divisible by another.
- **isNull()** - check if the string is null.
- **isLength(min [, max])** - check if the string's length falls in a range. Note: this function takes into account surrogate pairs.
- **isByteLength(min [, max])** - check if the string's length (in bytes) falls in a range.
- **isUUID([version])** - check if the string is a UUID (version 3, 4 or 5).
- **isDate()** - check if the string is a date.
- **isAfter([date])** - check if the string is a date that's after the specified date (defaults to now).
{'fraction_non_alphanumeric': 0.14800471459841724, 'fraction_numerical': 0.003367570298029971, 'mean_word_length': 4.270629991126886, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 5, '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': '7499409', 'n_tokens_mistral': 1760, 'n_tokens_neox': 1721, 'n_words': 740}