# nv-string-s2n

> nv-string-s2n ======================= - parse a string to a number, same as eval("1.1....")

Latest version **0.0.2** (published 2023-06-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install nv-string-s2n
pnpm add nv-string-s2n
yarn add nv-string-s2n
bun add nv-string-s2n
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2023-06-30 |
| First published | 2023-06-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 32 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |

## Links

- npm: https://www.npmjs.com/package/nv-string-s2n
- npm.io page: https://npm.io/package/nv-string-s2n

## Dependencies (2)

- [nv-char-num](https://npm.io/package/nv-char-num.md) ^1.0.1
- [nv-char-ascii](https://npm.io/package/nv-char-ascii.md) ^1.0.1

## Recent versions

- 0.0.2 (latest) — 2023-06-30

## README

nv-string-s2n
=======================
- parse a string to a number, same as eval("1.1....")

- support 0b|0B  0o|0O  0x|0X , bigInt,  double, NaN , Infinity , -Infinity  JUST Like  parseFloat DO;
- support lodash _ seperator, loose rule, NOT so strict as parseFloat;

- extra  support  0q|0Q,   it means radix 4

- NOT support  oct-using-leading-0-without-oO, such as 034
- IF meet BigDemical, it do NOTHING  just return a pair ["maybe\_big\_demical",\<the-original-string\>]


- this pkg is SLOW(
         50 times slower than parseFloat/parseInt/Number/BigInt
   ) , should ONLY  be used in repl/cli TOOLS , its just for test the state-transfer when parseFloat. 

- but its faster than eval


- it is USED for test  0q123 0Q123  in nvlang,   nvlang support int-number-literal-of-radix-4


install
=======
- npm install nv-string-s2n


usage
=====
    
      const parse_numlike   = require("nv-string-s2n");
 

example
-------

				>               parse_numlike("0b111_001")
				57
				>               parse_numlike("0q12_30")
				108
				>               parse_numlike("-0o567")
				-375
				>               parse_numlike("-0xabcdef")
				-11259375
				> 
				>               parse_numlike("0b111_001n")
				57n
				>               parse_numlike("0q12_30n")
				108n
				>               parse_numlike("-0o567n")
				-375n
				>               parse_numlike("-0xabcdefn")
				-11259375n
				> 
				> 
				>                parse_numlike("1.1")
				1.1
				>                parse_numlike("-1.1E200")
				-1.1e+200
				> 
				>                parse_numlike("0b_11_10")
				14
				>                parse_numlike("0b123")
				Uncaught 'for bin:  only 0b[10_]+n? is valid'
				> 
				> 


TEST
=====

### long  0b

		TEST# node b.js 100000
		{ rounds: 1, f: [Function: using_Number], costed: 23.86091709136963 }
		{ rounds: 1, f: [Function: using_s2n], costed: 479.0749931335449 }
		{ rounds: 1, f: [Function: using_eval], costed: 670.5458121299744 }

###  short 0b

		TEST# node short-b.js 100000
		{ rounds: 1, f: [Function: using_Number], costed: 9.460304737091064 }
		{ rounds: 1, f: [Function: using_s2n], costed: 6.899360656738281 }
		{ rounds: 1, f: [Function: using_eval], costed: 64.11680889129639 }
		root@dli:/mnt/sda3/NV6-/nvstr/pkgs/nv-string-s2n/TEST# 


METHODS
========


APIS
=======


LICENSE
=======
- ISC

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