# pragma-singleton

> Singleton design pattern implementation which easy to use

Latest version **1.0.3** (published 2013-08-21) · 0 weekly downloads

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

## Install

```sh
npm install pragma-singleton
pnpm add pragma-singleton
yarn add pragma-singleton
bun add pragma-singleton
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2013-08-21 |
| First published | 2013-08-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Pragma Dudes |
| Maintainers | pragma-dudes |
| Keywords | singleton, patterns, design |

## Links

- npm: https://www.npmjs.com/package/pragma-singleton
- Repository: https://github.com/pragma-dudes/pragma-singleton
- Issues: https://github.com/pragma-dudes/pragma-singleton/issues
- npm.io page: https://npm.io/package/pragma-singleton

## Recent versions

- 1.0.3 (latest) — 2013-08-21

## README

#Pragma Singleton [![Build Status](https://secure.travis-ci.org/pragma-dudes/pragma-singleton.png)](http://travis-ci.org/pragma-dudes/pragma-singleton) [![NPM version](https://badge.fury.io/js/pragma-singleton.png)](http://badge.fury.io/js/pragma-singleton)

Singleton design pattern implementation which easy to use.

Just apply this to any constructor function and all 'new' operators for this constructor will return the same instance.

##Usage
To install just use NPM

```bash
npm install pragma-singleton
```

```javascript
var singleton = require('pragma-singleton');

function Constructor(someValue) {
	this.someValue = someValue;
}

var SingletonConstructor = singleton(Constructor),
	instance1 = new SingletonConstructor('value1'),
	instance2 = new SingletonConstructor('value2');

console.log(instance1 == instance2); // true, because the same instance
console.log(instance2.someValue); // value1, because the value of first created instance

```

Pragma Dudes wish you live long and prosper.

<info@pragma-dudes.org>

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