npm package: @psenger/bidirectional-map
Description: Bi Directional Map ( BIDI Map ) for NodeJS
Author: Philip A Senger
Latest version: 1.0.6

# Bidirectional Map

> A bidirectional map, is an associative data structure in which the pairs form a one-to-one
> relationship. The binary relation is functional in both direction: each value is mapped to a
> unique key.

<!--START_SECTION:toc-->

## Table of contents
- [Bidirectional Map](#bidirectional-map)
  * [API](#api)
    + [BiDirectionalMap](#bidirectionalmap)
      - [Parameters](#parameters)
      - [set](#set)
        * [Parameters](#parameters-1)
      - [species](#species)
  * [Example Usage](#example-usage)
  * [Installation Instructions](#installation-instructions)
  * [License](#license)
  * [Deployment Steps](#deployment-steps)

<!--END_SECTION:toc-->

<!--START_SECTION:jsdoc-->
## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### BiDirectionalMap

**Extends Map**

*   **See**: [wikipedia][1] for further information

Bi Directional Map is a Map, in which the keys and values are registered pointing to each
other ( a binary relationship ). EG A->B and B->A. This is a Advanced Data Type and is some times
called an Associative Data Structure.

Type: [BiDirectionalMap][2]

#### Parameters

*   `props` **Iterable?** An Iterable object whose elements are key-value pairs (arrays with two elements, e.g. \[\[ 1, \['one','two'] ],\[ 2, \['three'] ]]). Each key-value pair is added to the new Map; null values are treated as undefined.

**Meta**

*   **version**: 1.0.5

#### set

Sets the value for the key in the Map object. Overriding the parent `set` and returns the Map
object. Only works with `String` or \`Numbers.

##### Parameters

*   `key` **([string][3] | [number][4])** The key of the element to add to the `BiDirectionalMap` object.
*   `value` **([string][3] | [number][4])** The value of the element to add to the `BiDirectionalMap` object.

Returns **[BiDirectionalMap][2]**

#### species

Overwrite BiDirectionalMap species to the parent Map constructor

Returns **MapConstructor**

[1]: https://en.wikipedia.org/wiki/Bidirectional_map

[2]: #bidirectionalmap

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

<!--END_SECTION:jsdoc-->

<!--START_SECTION:file:TUTORIAL.md-->
## Example Usage

```javascript
const bidiMap = new BiDirectionalMap();
bidiMap.set(1, 2).set(3, 4);
console.log (`Key(1) = Value(${bidiMap.get(1)})` );
console.log (`Key(2) = Value(${bidiMap.get(2)})` );
console.log (`Key(3) = Value(${bidiMap.get(3)})` );
console.log (`Key(4) = Value(${bidiMap.get(4)})` );
// Key(1) = Value(2)
// Key(2) = Value(1)
// Key(3) = Value(4)
// Key(4) = Value(3)
for( let [Key,Value] of bidiMap.entries()){
    console.log(`Key(${Key}) = Value(${Value})`);
}
// Key(1) = Value(2)
// Key(2) = Value(1)
// Key(3) = Value(4)
// Key(4) = Value(3)
```

<!--END_SECTION:file:TUTORIAL.md-->

<!--START_SECTION:file:INSTALLATION.md-->
## Installation Instructions

```bash
npm install @psenger/bidirectional-map --save
```

or

```bash
yarn add @psenger/bidirectional-map
```

<!--END_SECTION:file:INSTALLATION.md-->

## License

<!--START_SECTION:file:LICENSE-->
MIT License

Copyright (c) 2021 Philip A Senger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

<!--END_SECTION:file:LICENSE-->

## Deployment Steps

* create a pull request from `dev` to `main`
* check out `main`
* `npm version patch -m "message here" or minor`
* `npm publish`
* Then switch to `dev` branch
* And then merge `main` into `dev` and push `dev` to origin