npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nv-cli-log-catch-param

v0.0.9

Published

cli tool find string-literal in js/ts/json

Readme

nv-cli-log-catch-param

  • cli-tool
  • insert a self-defined log in catchClause Body
  • this use RegExp + parser, so its slow IF too many files in path-dir, such as node_modules
  • for test macro IN nvlang

insert position

    this cli tool will insert a fixed-format log-function at the first-line   of CatchCaluse block:

     catch(e) {
         @INSERTED_LOG_FUNC@
     }

     catch([a0,a1....]) {
         @INSERTED_LOG_FUNC@
     }         

     catch({k0,k1....}) {
         @INSERTED_LOG_FUNC@
     }

log func format

  (function ___log_catchclause() {
         let ___catchclause_param___ = <CatchClause.param'shape auto calculated when parsing> 

         let ___nvlog = globalThis.___NVLOG ?? (           // ___NVLOG is your self-defined function of shape: 
                                                           //  (path:string,start:Dict,end:Dict,<CatchClause.param'shape auto calculated when parsing>)=>ANY
            content => {
                console.dir(content, {depth: null});
            }
          );

          ___nvlog(
             "/mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js",   // auto calculated when parsing
             {"line": 11,"column": 2},                                                            // auto calculated when parsing
             {"line": 15,"column": 1},                                                            //auto calculated when parsing
             ___catchclause_param___
         );
  })();

install

  • npm install nv-cli-log-catch-param -g

usage

            Usage: nv_cli_log_catch_param [options] 
            Options:
                -i, --insert          insert mode, default true
                -d, --delete          delete mode, default false
                -p, --path            path to search ,default ./
                -r, --regex           strlit name regexp pattern
                -u, --suffixes        default js ts json
                -h, --help            usage

example

insert

for example , a project TEST have 2 files:
            nv-cli-log-catch-param# tree TEST/
            TEST/
            ├── c0.js
            └── subdir
                └── c1.js

            1 directory, 2 files


            nv-cli-log-catch-param# cat TEST/c0.js
            try {} catch (e) {
              let a = 111;
            }


            nv-cli-log-catch-param# cat TEST/subdir/c1.js
            try {} catch ([e0, e1]) {
              let a = 111;
            }

            try {} catch ({
              k0,
              k1
            }) {
              let a = 111;
            }
   nv_cli_log_catch_param -p "./TEST" -i


            /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/c0.js
            Position { line: 2, column: 3 } Position { line: 4, column: 3 }
            before:
                try {} catch (e) {
                  let a = 111;
                }
            -----
            after:
                try {} catch (e) {
                  (function ___log_catchclause() {
                    let ___catchclause_param___ = e;
                
                    let ___nvlog = globalThis.___NVLOG ?? (content => {
                      console.dir(content, {
                        depth: null
                      });
                    });
                
                    ___nvlog("/mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/c0.js", {
                      "line": 2,
                      "column": 3
                    }, {
                      "line": 4,
                      "column": 3
                    }, ___catchclause_param___);
                  })();
                
                  let a = 111;
                }
            ==================
            /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js
            Position { line: 2, column: 2 } Position { line: 6, column: 1 }
            before:
                try {} catch ([e0, e1]) {
                  let a = 111;
                }
            -----
            after:
                try {} catch ([e0, e1]) {
                  (function ___log_catchclause() {
                    let ___catchclause_param___ = [e0, e1];
                
                    let ___nvlog = globalThis.___NVLOG ?? (content => {
                      console.dir(content, {
                        depth: null
                      });
                    });
                
                    ___nvlog("/mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js", {
                      "line": 2,
                      "column": 2
                    }, {
                      "line": 6,
                      "column": 1
                    }, ___catchclause_param___);
                  })();
                
                  let a = 111;
                }
            ==================
            /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js
            Position { line: 11, column: 2 } Position { line: 15, column: 1 }
            before:
                try {} catch ({
                  k0,
                  k1
                }) {
                  let a = 111;
                }
            -----
            after:
                try {} catch ({
                  k0,
                  k1
                }) {
                  (function ___log_catchclause() {
                    let ___catchclause_param___ = {
                      k0,
                      k1
                    };
                
                    let ___nvlog = globalThis.___NVLOG ?? (content => {
                      console.dir(content, {
                        depth: null
                      });
                    });
                
                    ___nvlog("/mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js", {
                      "line": 11,
                      "column": 2
                    }, {
                      "line": 15,
                      "column": 1
                    }, ___catchclause_param___);
                  })();
                
                  let a = 111;
                }
            ==================

delete

     nv_cli_log_catch_param -p "./TEST" -d
            /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/c0.js
            Position { line: 1, column: 7 } Position { line: 21, column: 1 }
            before:
                try {} catch (e) {
                  (function ___log_catchclause() {
                    let ___catchclause_param___ = e;

                    let ___nvlog = globalThis.___NVLOG ?? (content => {
                      console.dir(content, {
                        depth: null
                      });
                    });

                    ___nvlog("/mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/c0.js", {
                      "line": 2,
                      "column": 3
                    }, {
                      "line": 4,
                      "column": 3
                    }, ___catchclause_param___);
                  })();

                  let a = 111;
                }
            -----
            after:
                try {} catch (e) {
                  let a = 111;
                }
            ==================
            /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js
            Position { line: 1, column: 7 } Position { line: 21, column: 1 }
            before:
                try {} catch ([e0, e1]) {
                  (function ___log_catchclause() {
                    let ___catchclause_param___ = [e0, e1];

                    let ___nvlog = globalThis.___NVLOG ?? (content => {
                      console.dir(content, {
                        depth: null
                      });
                    });

                    ___nvlog("/mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js", {
                      "line": 2,
                      "column": 2
                    }, {
                      "line": 6,
                      "column": 1
                    }, ___catchclause_param___);
                  })();

                  let a = 111;
                }
            -----
            after:
                try {} catch ([e0, e1]) {
                  let a = 111;
                }
            ==================
            /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js
            Position { line: 23, column: 7 } Position { line: 49, column: 1 }
            before:
                try {} catch ({
                  k0,
                  k1
                }) {
                  (function ___log_catchclause() {
                    let ___catchclause_param___ = {
                      k0,
                      k1
                    };

                    let ___nvlog = globalThis.___NVLOG ?? (content => {
                      console.dir(content, {
                        depth: null
                      });
                    });

                    ___nvlog("/mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-log-catch-param/TEST/subdir/c1.js", {
                      "line": 11,
                      "column": 2
                    }, {
                      "line": 15,
                      "column": 1
                    }, ___catchclause_param___);
                  })();

                  let a = 111;
                }
            -----
            after:
                try {} catch ({
                  k0,
                  k1
                }) {
                  let a = 111;
                }
            ==================

LICENSE

  • ISC