<commit_before># Percent [![Build status](https://travis-ci.org/ZDroid/percent.png?branch=master)](https://travis-ci.org/ZDroid/percent) [![devDependency status](https://david-dm.org/ZDroid/percent/dev-status.png?theme=shields.io)](https://david-dm.org/ZDroid/percent#info=devDependencies)

> Percent control done right

Percent is npm module which gives you fine options to control percentages.

## Installation

With [npm](https://npmjs.org):

```bash
$ npm install percent
```

## Examples

**Calculate percentage**

```javascript
var percent = require('percent');

console.log(percent.calc(5, 20, 0, false)); // => 25
```

**Validate percentage**

```javascript
var percent = require('percent');

if (percent.valid(5)) { // => true
  console.log('5 is valid percent value');
}
```

**Compare percentages**

```javascript
var percent = require('percent');

a = '5%';
b = 6;

if (percent.lt(a, b)) { // => true
  console.log('a is smaller than b');
}
```

## API

```javascript
var percent = require('percent');
```

### percent.calc(value, total, decimal, sign)

Example: `percent.calc(5, 20, 0, false)`

Calculates percent value from the given number (`value`) and total number
(`total`) with specified number of decimals (`decimal`).

`sign` is boolean which turns percent sign (`%`) addition. `percent.calc` will
return percent value with percent sign if `sign` is `true`.

### percent.valid(thing)

Example: `percent.valid('5%')`

Checks if `thing` is valid percent value. It is valid if it's number,
number-like string (e.g. `'10'`, not `10`), or string with number and percent
sign. Spaces are allowed in strings.

### percent.sign(thing)

Example: `percent.sign(5)`

Adds percent sign to `thing`.

### percent.unsign(thing)

Example: `percent.unsign('5%')`

Removes percent sign(s) from `thing`.

### percent.lt(l, t)

Example: `percent.lt('5%', 6)`

Checks is the first argument smaller than second.

### percent.gt(g, t)

Example: `percent.gt('6%', 5)`

Check is the first argument greater than second.

### percent.eq(e, q)

Example: `percent.eq('5%', 5)`

Checks are the arguments equal.

### percent.neq(ne, q)

Example: `percent.neq('6%', 5)`

Checks are the arguments unequal.

## License

MIT &copy; [<NAME>](https://github.com/ZDroid)<commit_msg>[ci skip] Improve (n)eq docs<commit_after># Percent [![Build status](https://travis-ci.org/ZDroid/percent.png?branch=master)](https://travis-ci.org/ZDroid/percent) [![devDependency status](https://david-dm.org/ZDroid/percent/dev-status.png?theme=shields.io)](https://david-dm.org/ZDroid/percent#info=devDependencies)

> Percent control done right

Percent is npm module which gives you fine options to control percentages.

## Installation

With [npm](https://npmjs.org):

```bash
$ npm install percent
```

## Examples

**Calculate percentage**

```javascript
var percent = require('percent');

console.log(percent.calc(5, 20, 0, false)); // => 25
```

**Validate percentage**

```javascript
var percent = require('percent');

if (percent.valid(5)) { // => true
  console.log('5 is valid percent value');
}
```

**Compare percentages**

```javascript
var percent = require('percent');

a = '5%';
b = 6;

if (percent.lt(a, b)) { // => true
  console.log('a is smaller than b');
}
```

## API

```javascript
var percent = require('percent');
```

### percent.calc(value, total, decimal, sign)

Example: `percent.calc(5, 20, 0, false)`

Calculates percent value from the given number (`value`) and total number
(`total`) with specified number of decimals (`decimal`).

`sign` is boolean which turns percent sign (`%`) addition. `percent.calc` will
return percent value with percent sign if `sign` is `true`.

### percent.valid(thing)

Example: `percent.valid('5%')`

Checks if `thing` is valid percent value. It is valid if it's number,
number-like string (e.g. `'10'`, not `10`), or string with number and percent
sign. Spaces are allowed in strings.

### percent.sign(thing)

Example: `percent.sign(5)`

Adds percent sign to `thing`.

### percent.unsign(thing)

Example: `percent.unsign('5%')`

Removes percent sign(s) from `thing`.

### percent.lt(l, t)

Example: `percent.lt('5%', 6)`

Checks is the first argument smaller than second.

### percent.gt(g, t)

Example: `percent.gt('6%', 5)`

Check is the first argument greater than second.

### percent.eq(e, q)

Example: `percent.eq('5%', 5)`

Checks are the arguments logically equal.

### percent.neq(ne, q)

Example: `percent.neq('6%', 5)`

Checks are the arguments logically unequal.

## License

MIT &copy; [<NAME>](https://github.com/ZDroid)
{'fraction_non_alphanumeric': 0.1783132530120482, 'fraction_numerical': 0.012705366922234392, 'mean_word_length': 4.787072243346008, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 12, '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': '1232841', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1509, 'n_words': 457}