# nv-facutil-jsidize

> nv-facutil-jsidize =============== - convert any string to a valid-js-identifier-name - it is for converting lexical-binding-with-scope to a gloabl-var - normally useless

Latest version **1.0.2** (published 2022-04-14) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install nv-facutil-jsidize
pnpm add nv-facutil-jsidize
yarn add nv-facutil-jsidize
bun add nv-facutil-jsidize
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-04-14 |
| First published | 2022-04-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |

## Links

- npm: https://www.npmjs.com/package/nv-facutil-jsidize
- npm.io page: https://npm.io/package/nv-facutil-jsidize

## Dependencies (2)

- [nv-char-jsid](https://npm.io/package/nv-char-jsid.md) ^1.0.0
- [nv-facutil-eb64](https://npm.io/package/nv-facutil-eb64.md) ^1.0.0

## Recent versions

- 1.0.2 (latest) — 2022-04-14
- 1.0.1 — 2022-04-14
- 1.0.0 — 2022-04-14

## README

nv-facutil-jsidize
===============
- convert any string to a valid-js-identifier-name  AND convet from valid-js-identifier-name to a string
- it is for converting lexical-binding-with-scope  to a gloabl-var
- normally useless

rule
====

### encode

      if '$'                          :  '$' => '$$'
      elif invalid-js-identifier-char : chars => $<eb64(chars)>$
      else                            : do-nothing

      eb64 is variant of base64


install
=======
- npm install nv-facutil-jsidize 

usage
=====
    
       const x = require("nv-facutil-jsidize");

example
-------

### without prefix


        /*
        > _s2id('a-b.c')
        'a$LQ等等$$Lg等等$'
        >

        > let a$LQ等等$$Lg等等$ = 999
        > a$LQ等等$$Lg等等$
        999
        > _id2s('a$LQ等等$b$Lg等等$c')
        'a-b.c'
        >



        > _s2id('a     b')
        'a$ICAgICA等$b'
        >
        > let a$ICAgICA等$b =999
        > a$ICAgICA等$b
        999
        >

        > _id2s('a$ICAgICA等$b')
        'a     b'
        >



        > _s2id('a-b.c$$#')
        'a$LQ等等$b$Lg等等$c$$$$$Iw等等$'
        >

        let a$LQ等等$b$Lg等等$c$$$$$Iw等等$ = 999
        > a$LQ等等$b$Lg等等$c$$$$$Iw等等$
        999
        >


        > _id2s('a$LQ等等$b$Lg等等$c$$$$$Iw等等$')
        'a-b.c$$#'
        >


        */


### with prefix 

        /*
        > x.s2id('1ab')
        '___1ab'
        >
        > x.s2id('1a.b')
        '___1a$Lg等等$b'
        >
        > x.s2id('1#a')
        '___1$Iw等等$a'
        >
        > x.id2s('___1ab')
        '___1ab'
        >
        > x.id2s('___1a$Lg等等$b')
        '___1a.b'
        >
        > x.id2s('___1$Iw等等$a')
        '___1#a'
        >
        >

        */



API
====


    {
      DOLLAR: '$$',
      DASH: '$LQ等等$',
      DOT: '$Lg等等$',
      HASH: '$Iw等等$',
      SPACE: '$IA等等$',
      _s2id: [Function: _s2id],   (s:String):ValidJsIdentifierNameIgnoreStartNumChar
      s2id: [Function: s2id],     (s,prefix='___'):ValidJsIdentifierName
      _id2s: [Function: _id2s],   (id:ValidJsIdentifierNameIgnoreStartNumChar):String
      id2s: [Function: id2s]      (id:ValidJsIdentifierName,prefix='___'):String
    }






LICENSE
=======
- ISC

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