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-ctx-cflow

v1.0.1

Published

nv-ctx-cflow =============== - nv-ctx-cflow - several very simple small functions to simulate control-flow - for test using in nvlang, normally USELESS - nvlang normally USE graph-syntax to impl WHILE / IF; for backward compatible it provide serveral O

Downloads

3

Readme

nv-ctx-cflow

  • nv-ctx-cflow

  • several very simple small functions to simulate control-flow

  • for test using in nvlang, normally USELESS

  • nvlang normally USE graph-syntax to impl WHILE / IF; for backward compatible it provide serveral OPERS

  • to avoid using while/if in app/dsl-layer-code(make the app-layer-code easy to parse/unparse/validate/authorize)

  • similiar to nv-facutil-simple-ctx+nv-facutil-loop+nv-facutil-simple-continue, just for compatible with nvlang-syntax

why

 IN nvlang dsl-layer-AND-app-layer, parse/unparse code IS frequently operation:
     when do auto-generate/static-stracing for app-layer-code: 
         the lexical-block such as while/if make things complicated(
                COZ if-branch normally can ONLY  be decided in runtime
         ) which SLOW-DOWN  the parse/unparse (
                IF your dsl/app frequently do parse/unparse operation
         ) 
SO nvlang SUGGEST only write if/while in ir-layer, make things simple

install

  • npm install nv-ctx-cflow

usage

    const {creat_ctx}           = require("nv-ctx-basic");
    const {whil,elif,ifif,nmif} = require("nv-ctx-cflow");

    whil.ss(ctx,cond_func,handle_func)               (cond_func IS  sync)  AND  (handle_func IS sync)
    whil.as(ctx,cond_func,handle_func)               (cond_func IS async)  AND  (handle_func IS sync)
    whil.sa(ctx,cond_func,handle_func)               (cond_func IS  sync)  AND  (handle_func IS async)
    whil.sa(ctx,cond_func,handle_func)               (cond_func IS async)  AND  (handle_func IS async)

    whil.whil(
       ctx:Ctx,
       cond_func:     async@optional (ctx:Ctx):Ctx => {...},
       handle_func:   async@optional (ctx:Ctx):Ctx => {...},
    )


    // if elif ....elif else, fst-match
    elif.ss(ctx,cond_handle_entries,else_handle)
    elif.sa(ctx,cond_handle_entries,else_handle)
    elif.as(ctx,cond_handle_entries,else_handle)
    elif.aa(ctx,cond_handle_entries,else_handle) 

    // if(){} if(){} ... if(){}, exec-all-matches   

    ifif.ss(ctx,cond_handle_entries)
    ifif.sa(ctx,cond_handle_entries)
    ifif.as(ctx,cond_handle_entries)
    ifif.aa(ctx,cond_handle_entries)


    //break if more than max_match_cnt matched 
    nmif.ss(ctx,max_match_cnt,cond_handle_entries)
    nmif.sa(ctx,max_match_cnt,cond_handle_entries)
    nmif.as(ctx,max_match_cnt,cond_handle_entries)
    nmif.aa(ctx,max_match_cnt,cond_handle_entries)

example

whil

    > var ctx = {a:0,sum:0}
    > var condf = (ctx)=>ctx.a<5
    > var handle = (ctx)=> {ctx.sum=ctx.sum+ctx.a;ctx.a=ctx.a+1;}
    > whil.ss(ctx,condf,handle)
    { a: 5, sum: 10 }
    > await whil.whil(ctx,condf,handle)
    { a: 5, sum: 10 }
    >    

elif

    var ctx = {a:31,rslt:undefined}

    var entries = [
       [(ctx)=>ctx.a<10,(ctx)=>ctx.rslt="lt(10)"],
       [(ctx)=>ctx.a<20,(ctx)=>ctx.rslt="ge(10) AND lt(20)"],
       [(ctx)=>ctx.a<30,(ctx)=>ctx.rslt="ge(20) AND lt(30)"]
    ]

    var else_handle = (ctx)=>ctx.rslt="ge(30)"



    > await elif.elif(ctx,entries,else_handle)
    { a: 31, rslt: 'ge(30)' }
    > 

ifif

    var ctx = {a:30,rslt:[]}

    var entries = [
       [(ctx)=>ctx.a%2===0,(ctx)=>ctx.rslt.push(2)],
       [(ctx)=>ctx.a%3===0,(ctx)=>ctx.rslt.push(3)],
       [(ctx)=>ctx.a%5===0,(ctx)=>ctx.rslt.push(5)]
    ]


    await ifif.ifif(ctx,entries)
	/*
	{ a: 30, rslt: [ 2, 3, 5 ] }
	*/

nmif

    var ctx = {a:30,rslt:[]}

    var entries = [
       [(ctx)=>ctx.a%2===0,(ctx)=>ctx.rslt.push(2)],
       [(ctx)=>ctx.a%3===0,(ctx)=>ctx.rslt.push(3)],
       [(ctx)=>ctx.a%5===0,(ctx)=>ctx.rslt.push(5)]
    ]


    await nmif.nmif(ctx,2,entries)
	/*
	{ a: 30, rslt: [ 2, 3 ] }
	*/

METHODS

API

    {
      whil: {
        whil: [AsyncFunction: whil],
        ss: [Function: ss],
        sa: [AsyncFunction: sa],
        as: [AsyncFunction: as],
        aa: [AsyncFunction: aa]
      },
      elif: {
        elif: [AsyncFunction: elif],
        ss: [Function: ss],
        sa: [AsyncFunction: sa],
        as: [AsyncFunction: as],
        aa: [AsyncFunction: aa]
      },
      ifif: {
        ifif: [AsyncFunction: ifif],
        ss: [Function: ss],
        sa: [AsyncFunction: sa],
        as: [AsyncFunction: as],
        aa: [AsyncFunction: aa]
      },
      nmif: {
        nmif: [AsyncFunction: nmif],
        ss: [Function: ss],
        sa: [AsyncFunction: sa],
        as: [AsyncFunction: as],
        aa: [AsyncFunction: aa]
      }
    }

LICENSE

  • ISC