# natscode

> Retrieve the natscode passed via QueryString or Cookie

Latest version **1.0.10** (published 2019-08-03) · ISC license · 0 weekly downloads

## Install

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

## 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.10 |
| Published | 2019-08-03 |
| First published | 2016-01-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Darwin Biler |
| Maintainers | buonzz |
| Keywords | nats, tgp, fhg, gallery, tmm, adult, tour, paysite |

## Links

- npm: https://www.npmjs.com/package/natscode
- Repository: https://github.com/buonzz/natscode
- Homepage: https://shop.bilersolutions.com/products/natscode
- Issues: https://github.com/buonzz/natscode/issues
- npm.io page: https://npm.io/package/natscode

## Dependencies (1)

- [query-string](https://npm.io/package/query-string.md) ^5.0.1

## Recent versions

- 1.0.10 (latest) — 2019-08-03
- 1.0.9 — 2018-04-22
- 1.0.8 — 2018-04-22
- 1.0.7 — 2018-02-18
- 1.0.6 — 2017-11-12
- 1.0.5 — 2017-11-12
- 1.0.4 — 2017-11-12
- 1.0.3 — 2017-11-12
- 1.0.2 — 2017-11-12
- 1.0.1 — 2017-11-12
- 1.0.0 — 2016-01-24

## README

# Natscode

Build [NATS LinkCodes](http://tmmwiki.com/index.php/NATS4_LinkCodes) using JavaScript only.


When you are building a tour, you often need to build the proper linkcode going to your join pages, so it will be able to carry out the natscode stored in either the browser cookie and or querystring. Most solution often requires that you to write a backend php code that reads the value from cookie or querstring, but that is not efficient since JavaScript can also get that info w/o having to contact the backend!


This is extremely useful, if you have a static html tour or building a single page application, and you want the tour to be completely independent of the backend codes.



## Installation


```
npm install natscode
```



## Usage


in order to use it, require it in your application

```
var natscode = require("natscode");
```

generate a nats linkcode

```
var linkcode = natscode.link({
	"default_natscode": "hello",
	"linkdomain": "join.example.com"
});

console.log(linkcode);

```

the above will generate a link like this: http://join.example.com/signup/signup.php?nats=hello

get only the natscode value
```
var nats = natscode.value({
	"default_natscode": "hello",
	"linkdomain": "join.example.com"
});

console.log(nats);
```

will output "hello" if either there is no nats present in cookie or querystring.

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