# nv-cli-sync-and-async

> nv-cli-sync-and-async ===================== - nv-cli-sync-and-async is a simple cli-tool - creat sync-version of source-code AND async-version of source code

Latest version **1.0.2** (published 2022-03-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install nv-cli-sync-and-async
pnpm add nv-cli-sync-and-async
yarn add nv-cli-sync-and-async
bun add nv-cli-sync-and-async
```

Provides the command `nv_sync_and_async`.

## 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.2 |
| Published | 2022-03-05 |
| First published | 2022-03-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |

## Links

- npm: https://www.npmjs.com/package/nv-cli-sync-and-async
- npm.io page: https://npm.io/package/nv-cli-sync-and-async

## Dependencies (4)

- [nv-cli-basic](https://npm.io/package/nv-cli-basic.md) ^1.0.6
- [nv-path-basic](https://npm.io/package/nv-path-basic.md) ^1.0.3
- [nv-cli-add-missing-async](https://npm.io/package/nv-cli-add-missing-async.md) ^1.0.1
- [nv-cli-remove-sync-await](https://npm.io/package/nv-cli-remove-sync-await.md) ^0.0.2

## Recent versions

- 1.0.2 (latest) — 2022-03-05
- 1.0.1 — 2022-03-04
- 1.0.0 — 2022-03-04

## README

nv-cli-sync-and-async
=====================
- nv-cli-sync-and-async is a simple cli-tool   
- creat sync-version of source-code AND async-version of source code

install
=======
- npm install nv-cli-sync-and-async -g 

usage
=====

        Usage: nv_sync_and_async  [options]
        Options:
            -i, --input         input string ,default stdin
            -o, --output        output string,default stdout
            -h, --help          usage

 

    
example
-------

### file to file


           //this source code write as follows<see cat-of-lib.js below>:
           //   IF await scope-function-node is NOT async:
           //       will creat both a sync-version AND a async-version
           //   IF await scope-function-node is     async:
           //       will do nothing
            
           # cat lib.js

            function maybe(G,other) {
                let acc = 0;
                for await(let each of G) {
                    acc = acc + each
                }
                acc = acc + (await other)
                return(acc)
            }

            module.exports = maybe
            #


           # nv_sync_and_async -i lib.js -o mylib.js

           # ls -l | egrep mylib
            -rw-r--r--   1 root root  185 Mar  4 03:06 mylib.async.js
            -rw-r--r--   1 root root  164 Mar  4 03:06 mylib.sync.js



           # cat mylib.async.js
            //ASYNC:
            async function maybe(G, other) {
              let acc = 0;

              for await (let each of G) {
                acc = acc + each;
              }

              acc = acc + (await other);
              return acc;
            }

            module.exports = maybe;
           #

           # cat mylib.sync.js
            //SYNC:
            function maybe(G, other) {
              let acc = 0;

              for (let each of G) {
                acc = acc + each;
              }

              acc = acc + other;
              return acc;
            }

            module.exports = maybe;


### stdin to stdout

    class Cls {
            static smethod () {
                    while(true) {
                            d[await 3] = 100;
                    }
            }
        method() {
                    await 100
            }
    }


^C
nv-cli-sync-and-async# node cli.js

            class Cls {
                    static smethod () {
                            while(true) {
                                    d[await 3] = 100;
                            }
                    }
                method() {
                            await 100
                    }
            }

          
         //=============>press ctrl+D  



        //SYNC:
        class Cls {
          static smethod() {
            while (true) {
              d[3] = 100;
            }
          }

          method() {
            100;
          }

        }
        /*================*/


        //ASYNC:
        class Cls {
          static async smethod() {
            while (true) {
              d[await 3] = 100;
            }
          }

          async method() {
            await 100;
          }

        }
        /*================*/




LICENSE
=======
- ISC

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