# @agen/ns

> Utility methods for async generators

Latest version **0.5.2** (published 2020-02-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @agen/ns
pnpm add @agen/ns
yarn add @agen/ns
bun add @agen/ns
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2020-02-01 |
| First published | 2020-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mikhail Kotelnikov |
| Maintainers | mkotelnikov |

## Links

- npm: https://www.npmjs.com/package/@agen/ns
- Repository: https://github.com/mkotelnikov/agen/agen
- Homepage: https://github.com/mkotelnikov/agen
- npm.io page: https://npm.io/package/@agen/ns

## Recent versions

- 0.5.2 (latest) — 2020-02-01
- 0.5.1 — 2020-01-28
- 0.5.0 — 2020-01-28
- 0.4.0 — 2020-01-24

## README

@agen/ns
========

Global namespace for `@agen` packages.

This package contains the following utility methods and fields:
* `ns` the namespace itself
* `getGlobal` - returns a global variable
* `setGlobal` - allows to overload/redefine a global variable used by other methods

Example: defining global variables for NodeJS platform (before v13):
```javascript

const { getGlobal, setGlobal } = require('@agen/ns');
if (!getGlobal('TextDecoder')) setGlobal('TextDecoder', require('util').TextDecoder);
...

```

`getGlobal`
-----------

This method returns a global variable with the specified name.
Parameters:
* name - name of the global variable to return

Example:
```javascript

const { getGlobal } = require('@agen/ns');
const TextEncoder = getGlobal('TextEncoder');
...
```

`setGlobal`
-----------

This method redefines a globally used variables:
* name - name of the variable
* value - a new value to set

Example:
```javascript

const { setGlobal } = require('@agen/ns');

setGlobal('TextEncoder', require('util').TextEncoder);
```

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