<commit_before><p align="center">
  <a href="">
    <img alt="Logo" src="logo.png" width="500px">
  </a>
</p>

<p align="center">
  Simple module to calculate electrical resistance in series and parallel circuits.
</p>

<p align="center">

  <a href="https://codeship.com/projects/"><img alt="Build Status" src="https://codeship.com/projects"></a>

  <a href="https://travis-ci.org/mabrasil/resistance.js"><img alt="Build Status" src="https://travis-ci.org/mabrasil/resistance.js.svg?branch=master"></a>

  <a href="https://codeclimate.com/github/mabrasil/resistance.js"><img alt="Code Climate" src="https://codeclimate.com/github/mabrasil/resistance.js/badges/gpa.svg"/></a>

  <a href="https://david-dm.org/mabrasil/resistance.js" title="Dependency status"><img src="https://david-dm.org/mabrasil/resistance.js.svg"/></a>

  <a href="https://david-dm.org/mabrasil/resistance.js#info=devDependencies" title="devDependency status"><img src="https://david-dm.org/mabrasil/resistance.js/dev-status.svg"/></a>

</p>

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
- [Development](#development)
- [Contributing](#contributing)
- [Motivation](#motivation)
- [License](#license)

## Installation

```sh
$ npm install --save resistance.js
```

## Usage

```js
const resistance = require('resistance.js');

resistance([1, 2, 3], 'series');
//=> 6

resistance([1, 2, 3], 'parallel');
//=> 0.5454545454545455

console.log(resistance([1, 2, 3], 'series') + 'Ω')
//=> 6Ω
```

## API

### resistance(circuit, type)

#### circuit

*Type*: `array`

*Description*: Values of resistors associated in your circuit.

*Example*: `[1, 2, 3, 4]`

#### type

*Type*: `string`

*Description*: Type of resistors association in your circuit.

*Options*:

  - `'series'` or `'s'`: Resistors in series.
  - `'parallel'` or `'p'`: Resistors in parallel.

## Development

All the tasks needed for development automation are defined in the
[`package.json`](package.json) *scripts* property and can be run via:

`npm run <command>`

Here is a summary of all the commands:

|  **Command**  |                                     **Description**                                      |
|---------------|------------------------------------------------------------------------------------------|
| `setup`       | Installs global Node dependencies needed for development.                                |
| `compile`     | Runs the Livescript compile on the source.                                               |
| `test:unit`   | Runs [Mocha](https://mochajs.org/) in BDD mode.                                          |
| `test:report` | Runs [Istanbul](https://github.com/gotwarlost/istanbul) coverage reports on Mocha tests. |
| `test`:       | Runs both `test:unit` and `test:report` commands.                                        |
| `build`:      | Runs both `compile` and `test` commands.                                                 |

## Contributing

Contributions are very welcome! If you'd like to contribute, these
[guidelines](CONTRIBUTING.md) may help you.

## Motivation
<commit_msg>Add a little about resistors<commit_after><p align="center">
  <a href="">
    <img alt="Logo" src="logo.png" width="500px">
  </a>
</p>

<p align="center">
  Simple module to calculate electrical resistance in series and parallel circuits.
</p>

<p align="center">

  <a href="https://codeship.com/projects/"><img alt="Build Status" src="https://codeship.com/projects"></a>

  <a href="https://travis-ci.org/mabrasil/resistance.js"><img alt="Build Status" src="https://travis-ci.org/mabrasil/resistance.js.svg?branch=master"></a>

  <a href="https://codeclimate.com/github/mabrasil/resistance.js"><img alt="Code Climate" src="https://codeclimate.com/github/mabrasil/resistance.js/badges/gpa.svg"/></a>

  <a href="https://david-dm.org/mabrasil/resistance.js" title="Dependency status"><img src="https://david-dm.org/mabrasil/resistance.js.svg"/></a>

  <a href="https://david-dm.org/mabrasil/resistance.js#info=devDependencies" title="devDependency status"><img src="https://david-dm.org/mabrasil/resistance.js/dev-status.svg"/></a>

</p>

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
- [Understand the Topic](#understand-the-topic)
- [Development](#development)
- [Contributing](#contributing)
- [Motivation](#motivation)
- [License](#license)

## Installation

```sh
$ npm install --save resistance.js
```

## Usage

```js
const resistance = require('resistance.js');

resistance([1, 2, 3], 'series');
//=> 6

resistance([1, 2, 3], 'parallel');
//=> 0.5454545454545455

console.log(resistance([1, 2, 3], 'series') + 'Ω')
//=> 6Ω
```

## API

### `resistance(circuit, type)`

#### `circuit`

*Type*: `array`

*Description*: Values of resistors associated in your circuit.

*Example*: `[1, 2, 3, 4]`

#### `type`

*Type*: `string`

*Description*: Type of resistors association in your circuit.

*Options*:

  - `'series'` or `'s'`: Resistors in series.
  - `'parallel'` or `'p'`: Resistors in parallel.

## Understand the Topic

Combinating resistors is very common in many circuits, when we want to reach a
resistance level which only one resistor is not enough.

### Resistors in Series

In an association of series resistors, the equivalent resistor is equal to the
sum of all resistors that make up the association:

```
Req = R1 + R2 + R3 + R4 + ...
```

Also, the voltage in the electric generator is equal to the sum of all the
voltages of resistors:

```
V = V1 + V2 + V3 + V4 + ...
```

The electric current flowing in each resistor is always the same:

```
i = i1 = i2 = i3 = i4 ...
```

### Resistors in Parallel

In an association of parallel resistors, the equivalent resistor is equal to
the inverse of the sum of all the inverted resistors which make up the
association:

```
1 / Req = (1 / R1) + (1 / R2) + (1 / R3) + (1 / R4) + ...
```

Also, the current in the equivalent resistor is equal to the sum of currents
from the resistors:

```
 i = i1 + i2 + i3 + i4 + ...
```

The voltage in the electric generator is always the same:

```
V = V1 = V2 = V3 = V4 = ...
```

## Development

All the tasks needed for development automation are defined in the
[`package.json`](package.json) *scripts* property and can be run via:

`npm run <command>`

Here is a summary of all the commands:

|  **Command**  |                                     **Description**                                      |
|---------------|------------------------------------------------------------------------------------------|
| `setup`       | Installs global Node dependencies needed for development.                                |
| `compile`     | Runs the Livescript compile on the source.                                               |
| `test:unit`   | Runs [Mocha](https://mochajs.org/) in BDD mode.                                          |
| `test:report` | Runs [Istanbul](https://github.com/gotwarlost/istanbul) coverage reports on Mocha tests. |
| `test`        | Runs both `test:unit` and `test:report` commands.                                        |
| `build`       | Runs both `compile` and `test` commands.                                                 |

## Contributing

Contributions are very welcome! If you'd like to contribute, these
[guidelines](CONTRIBUTING.md) may help you.

## Motivation

{'fraction_non_alphanumeric': 0.18705035971223022, 'fraction_numerical': 0.01343830595900638, 'mean_word_length': 2.633136094674556, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 59, 'https://': 24, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2664652', 'n_tokens_mistral': 2426, 'n_tokens_neox': 2226, 'n_words': 629}