# swap-function

> Swap variables in function

Latest version **1.0.0** (published 2019-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install swap-function
pnpm add swap-function
yarn add swap-function
bun add swap-function
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-05-11 |
| First published | 2019-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Rickhy Siswanto |
| Maintainers | rickhysis |

## Links

- npm: https://www.npmjs.com/package/swap-function
- Repository: https://github.com/rickhysis/swap-function
- Homepage: https://github.com/rickhysis/swap-function#readme
- Issues: https://github.com/rickhysis/swap-function/issues
- npm.io page: https://npm.io/package/swap-function

## Recent versions

- 1.0.0 (latest) — 2019-05-11

## README

# Swap Function
Swap variables in function. Swap , the act of swapping two variables refers to mutually exchanging the values of the variables. Usually, this is done with the data in memory. For example, in a program, two variables. 

## Installation
To install, you can use npm or yarn:

```
npm install swap-function

or

yarn add swap-function
```

## Usage

Swap variables using temporary buffer
```
import {buf} from 'swap-function'

const [x, y] = buf(3, 2)
```
Swap variables using addition and subtraction.
```
import {addsub} from 'swap-function'

const [x, y] = addsub(3, 2)
```
Swap variables using XOR
```
import {xor} from 'swap-function'

const [x, y] = xor(3, 2)
```
Swap individual bits using XOR.
```
import {xor} from 'swap-function'

const [x, y] = bitsXor(3, 2. '0011')
```

## License
MIT © Rickhy Siswanto.

---
_Source: https://npm.io/package/swap-function · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
