# @absolunet/private-registry

> Private registry for classes

Latest version **2.0.0** (published 2019-03-19) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @absolunet/private-registry
pnpm add @absolunet/private-registry
yarn add @absolunet/private-registry
bun add @absolunet/private-registry
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-03-19 |
| First published | 2018-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 11.12.0 |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Absolunet |
| Maintainers | absolunetdev, jblandry |
| Keywords | class, private, registry, weakmap |

## Links

- npm: https://www.npmjs.com/package/@absolunet/private-registry
- Repository: https://github.com/absolunet/node-private-registry
- Issues: https://github.com/absolunet/node-private-registry/issues
- npm.io page: https://npm.io/package/@absolunet/private-registry

## Recent versions

- 2.0.0 (latest) — 2019-03-19
- 1.1.0 — 2018-09-27
- 1.0.0 — 2018-09-17

## README

# @absolunet/private-registry

[![npm](https://img.shields.io/npm/v/@absolunet/private-registry.svg)](https://www.npmjs.com/package/@absolunet/private-registry)
[![npm dependencies](https://david-dm.org/absolunet/node-private-registry/status.svg)](https://david-dm.org/absolunet/node-private-registry)
[![npms](https://badges.npms.io/%40absolunet%2Fprivate-registry.svg)](https://npms.io/search?q=%40absolunet%2Fprivate-registry)
[![Travis CI](https://api.travis-ci.org/absolunet/node-private-registry.svg?branch=master)](https://travis-ci.org/absolunet/node-private-registry/builds)
[![Code style](https://img.shields.io/badge/code_style-@absolunet/node-659d32.svg)](https://github.com/absolunet/eslint-config-node)

> Private registry for classes


## Install

```sh
$ npm install @absolunet/private-registry
```


## Usage

```js
const __ = require('@absolunet/private-registry');


class Foo {

	constructor(id) {
		__(this).set({
			id:   `id::${id}`,
			seed: Math.random()
		});
	}

	set bar(id) {
		__(this).set('id', `id::${id}`);
	}

	get bar() {
		return `My id is ${__(this).get('id')}`;
	}

	get bar2() {
		const { id, seed } = __(this).get();
		return `${id}::${seed}`;
	}

}


const a = new Foo('123');
const b = new Foo('456');

console.log(a.bar);
console.log(b.bar);
console.log(b.bar2);

// My id is id::123
// My id is id::456
// id::456::0.0337644127126262
```


## API

### get()
Return `Object` of all registry entries



### get(name)
Return value of a registry's entry

#### name
*Required*<br>
Type: `String`<br>
Entry's name.



### set(object)
Set all entries from object into the registry

#### object
*Required*<br>
Type: `Object`<br>
Object which each entry will be added to the registry



### set(name, value)
Set entry into the registry

#### name
*Required*<br>
Type: `String`<br>
Entry's name.

#### value
*Required*<br>
Type: Any<br>
Value of the entry



## License

MIT © [Absolunet](https://absolunet.com)

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