# nsobject

> A utility to store namespaced objects globally

Latest version **1.0.3** (published 2016-08-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install nsobject
pnpm add nsobject
yarn add nsobject
bun add nsobject
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2016-08-22 |
| First published | 2016-08-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | thelettereproduction |

## Links

- npm: https://www.npmjs.com/package/nsobject
- npm.io page: https://npm.io/package/nsobject

## Recent versions

- 1.0.3 (latest) — 2016-08-22
- 1.0.2 — 2016-08-22
- 1.0.1 — 2016-08-22
- 1.0.0 — 2016-08-22

## README

# NS Object

## An easy to use namespace configuration utility

`nsobject` makes it easy to configure data you need available in a singleton fashion across all instances of an object or require calls that don't cache for some reason.

### Getting Started

**Install the module:**
```
npm install --save nsobject
```

**Require the module:**
```
var nsobject = require('nsobject');
```

**Create your namespace:**
```
var namespace = nsobject.create('DB.MONGO', {
    host: 'localhost',
    port: 1000
});
```

**Now that you created your namespace you can access it in any file using the namespace key!!**
```
var namespace = nsobject.get('DB.MONGO');
    console.log(namespace.host); //localhost
    console.log(namespace.port); 1000
```

**Override namespace object properties and they'll stick:**

*file a -*
```
var namespace = nsobject.get('DB.MONGO');
    namespace.host = 'http://mongo.remote-01.com';
```

*file b -*
```
var namespace = nsobject.get('DB.MONGO');
    console.log(namespace.host); //http://mongo.remote-01.com
```

**OR override the entire ns object:**
```
var namespace = nsobject.set('DB.MONGO', {foo: 'bar'});
```

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