# nv-random-pson

> nv-random-pson ======================= - generate a random JSON, whose string-lelement could be directly using '"' + str + '"' when do JSON.stringify - nvlang support a subset-of-json called pson

Latest version **1.0.3** (published 2023-07-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install nv-random-pson
pnpm add nv-random-pson
yarn add nv-random-pson
bun add nv-random-pson
```

## 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 | 2023-07-24 |
| First published | 2023-07-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 59.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |

## Links

- npm: https://www.npmjs.com/package/nv-random-pson
- npm.io page: https://npm.io/package/nv-random-pson

## Dependencies (2)

- [nv-random-number](https://npm.io/package/nv-random-number.md) ^1.0.3
- [nv-random-just-quote-str](https://npm.io/package/nv-random-just-quote-str.md) ^1.0.1

## Recent versions

- 1.0.3 (latest) — 2023-07-24
- 1.0.2 — 2023-07-24
- 1.0.1 — 2023-07-05

## README

nv-random-pson
=======================
- generate a random JSON, whose string-lelement  could be directly using '"' + str + '"'  when do JSON.stringify
- nvlang support a subset-of-json called pson

### pson 
        pson string  must can be directly quote when do stringify AND NOT include 4-bytes UTF8
        pson number's absolute value  must between [0.000001,1e+21)  
             // to avoid using  scientific notation 
             // scientific notation  IS hard to understand , its boring 


- this pkg is for test pson, normally USELESS

install
=======
- npm install nv-random-pson


usage
=====

             const x = require("nv-random-pson")    
 

example
-------




		var [top,stats] = x.creat();


		/*
		> stats
		Cnt {
		  A: 52334,
		  D: 52408,
		  S: 104650,
		  N: 36314,
		  t: 6591,
		  f: 6594,
		  n: 3253,
		  c: 262144
		}
		> 

		> JSON.stringify(top).length
		2107341
		> 
		*/

		var [top,stats] = x.creat({max_total_cnt:2000000})

		/*
		> stats
		Cnt {
		  A: 399911,
		  D: 400321,
		  S: 799148,
		  N: 275418,
		  t: 49863,
		  f: 50631,
		  n: 24708,
		  c: 2000000
		}
		> JSON.stringify(top).length
		16105843
		> 
		*/

		/*
		> x.get_max_str_sz()
		128
		*/
		x.set_max_str_sz(8); // for creat very big json, the string must be small , else OOM crash

		var [top,stats] = x.creat({max_total_cnt:10000000})
		/*
		this will cost a long time (because random generate string element is very slow) 10s- 20s

		> stats
		Cnt {
		  A: 2000882,
		  D: 2000581,
		  S: 3998414,
		  N: 1375380,
		  t: 249586,
		  f: 250188,
		  n: 124969,
		  c: 10000000
		}
		> JSON.stringify(top).length   // generate a about 80M nested json 
		80497556 
		> 

		use it to test if your JSON.stringify fast enough

		*/




METHODS
========


APIS
=======


LICENSE
=======
- ISC

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