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-func-chain

v1.0.1

Published

nv-func-chain =============== - nv-func-chain - combine single-param-functions (whose rtrn still be same-shape-as param)

Readme

nv-func-chain

  • nv-func-chain
  • combine single-param-functions (whose rtrn still be same-shape-as param)

install

  • npm install nv-func-chain

usage

   const z = require("nv-func-chain")

example

sync just one layer

        var f0 = (a)=>a+2
        var f1 = (a)=>a*2
        var f2 = (a)=>a**2


        > f0(f1(f2(2)))
        10

        > z.print_sync_l2r("f0","f1","f2")
        'f0(f1(f2(ctx)))'
        >

        > var F = z.sync_l2r(f0,f1,f2)
        > F(2)
        10




        > f2(f1(f0(2)))
        64
        >

        > z.print_sync_r2l("f0","f1","f2")
        'f2(f1(f0(ctx)))'
        >

        > var F = z.sync_r2l(f0,f1,f2)
        > F(2)
        64
        >

async just one layer

    const delay_val = require("timers/promises").setTimeout;


    var f0 = async (a)=> await delay_val(2000,a+2);
    var f1 = async (a)=> await delay_val(2000,a*2);
    var f2 = async (a)=> await delay_val(2000,a**2);


    > await f0(await f1(await f2(2)))
    10
    >


    > z.print_async_l2r("f0","f1","f2")
    'await f0(await f1(await f2(ctx)))'
    >

    > var F = z.async_l2r(f0,f1,f2)
    > await F(2)
    10




    > await f2 (await f1 (await f0 (2)))
    64
    >

    > z.print_async_r2l("f0","f1","f2")
    'await f2 (await f1 (await f0 (ctx)))'
    >


    > var F = z.async_r2l(f0,f1,f2)
    > await F(2)
    64
    >

nested sync-function-array

    var f00 = (a)=>a+2
    var f01 = (a)=>a*2;
    var f10 = (a)=>a+3;
    var f11 = (a)=>a*3;
    var f12 = (a)=>a**3;
    var f03 = (a)=>a*2;

unparse

    > console.log(z.print_sync_nest_l2r(["f00","f01",["f10","f11","f12"],"f03"]))
    f00(
        f01(
              f10(
                  f11(
                      f12(
                        f03(
                            ctx
                        )
                      )
                  )
              )
        )
    )

run-to-complete

    > f00(
    ...     f01(
    .....           f10(
    .......               f11(
    .........                   f12(
    ...........                     f03(
    .............                        2
    .............                     )
    ...........                   )
    .........               )
    .......           )
    .....     )
    ... )
    392
    >

    > var F = z.sync_nest_l2r([f00,f01,[f10,f11,f12],f03])
    > F(2)
    392
    >

stepper

    var sgen = z.sync_gen_nest_l2r([f00,f01,[f10,f11,f12],f03])
    > var g = sgen(2)
    > g.next()
    { value: [ 4, [Function: f03], 0, 3 ], done: false }
    > g.next()
    { value: [ 64, [Function: f12], 1, 2 ], done: false }
    > g.next()
    { value: [ 192, [Function: f11], 1, 1 ], done: false }
    > g.next()
    { value: [ 195, [Function: f10], 1, 0 ], done: false }
    > g.next()
    { value: [ 390, [Function: f01], 0, 1 ], done: false }
    > g.next()
    { value: [ 392, [Function: f00], 0, 0 ], done: false }
    > g.next()
    { value: 392, done: true }
    > g.next()
    { value: undefined, done: true }
    >

right-to-left

    > console.log(z.print_sync_nest_r2l(["f00","f01",["f10","f11","f12"],"f03"]))
    f03(
          f12(
              f11(
                  f10(
                    f01(
                        f00(
                            ctx
                        )
                    )
                  )
              )
          )
    )




    f03(
          f12(
              f11(
                  f10(
                    f01(
                        f00(
                            2
                        )
                    )
                  )
              )
          )
    )
    >
    71874
    >


    > var F = z.sync_nest_r2l([f00,f01,[f10,f11,f12],f03])
    > F(2)
    71874
    >


    var sgen = z.sync_gen_nest_r2l([f00,f01,[f10,f11,f12],f03])
    > var g = sgen(2)

    > g.next()
    { value: [ 4, [Function: f00], 0, 0 ], done: false }
    > g.next()
    { value: [ 8, [Function: f01], 0, 1 ], done: false }
    > g.next()
    { value: [ 11, [Function: f10], 1, 0 ], done: false }
    > g.next()
    { value: [ 33, [Function: f11], 1, 1 ], done: false }
    > g.next()
    { value: [ 35937, [Function: f12], 1, 2 ], done: false }
    > g.next()
    { value: [ 71874, [Function: f03], 0, 3 ], done: false }
    > g.next()
    { value: 71874, done: true }
    > g.next()
    { value: undefined, done: true }
    >

nested async-function-array

       const delay_val = require("timers/promises").setTimeout;


        var f00 = async (a)=>await delay_val(1000,a+2)
        var f01 = async (a)=>await delay_val(1000,a*2);
        var f10 = async (a)=>await delay_val(1000,a+3);
        var f11 = async (a)=>await delay_val(1000,a*3);
        var f12 = async (a)=>await delay_val(1000,a**3);
        var f03 = async (a)=>await delay_val(1000,a*2);

left-to-right

        > console.log(z.print_async_nest_l2r(["f00","f01",["f10","f11","f12"],"f03"]))
        await f00(
            await f01(
                  await f10(
                      await f11(
                          await f12(
                            await f03(
                                ctx
                            )
                          )
                      )
                  )
            )
        )



        await f00(
            await f01(
                  await f10(
                      await f11(
                          await f12(
                            await f03(
                                2
                            )
                          )
                      )
                  )
            )
        )

        >
        392
        >


        > var F = z.async_nest_l2r([f00,f01,[f10,f11,f12],f03])
        > await F(2)
        392
        >

        var agen = z.async_gen_nest_l2r([f00,f01,[f10,f11,f12],f03])
        > var ag = agen(2)
        > await ag.next()
        { value: [ 4, [AsyncFunction: f03], 0, 3 ], done: false }
        > await ag.next()
        { value: [ 64, [AsyncFunction: f12], 1, 2 ], done: false }
        > await ag.next()
        { value: [ 192, [AsyncFunction: f11], 1, 1 ], done: false }
        > await ag.next()
        { value: [ 195, [AsyncFunction: f10], 1, 0 ], done: false }
        > await ag.next()
        { value: [ 390, [AsyncFunction: f01], 0, 1 ], done: false }
        > await ag.next()
        { value: [ 392, [AsyncFunction: f00], 0, 0 ], done: false }
        > await ag.next()
        { value: 392, done: true }
        >

right-to-left

        > console.log(z.print_async_nest_r2l(["f00","f01",["f10","f11","f12"],"f03"]))
        await f03(
              await f12(
                  await f11(
                      await f10(
                        await f01(
                            await f00(
                                ctx
                            )
                        )
                      )
                  )
              )
        )




        await f03(
              await f12(
                  await f11(
                      await f10(
                        await f01(
                            await f00(
                                2
                            )
                        )
                      )
                  )
              )
        )
        >
        71874
        >


        > var F = z.async_nest_r2l([f00,f01,[f10,f11,f12],f03])
        > await F(2)
        71874
        >


        var agen = z.async_gen_nest_r2l([f00,f01,[f10,f11,f12],f03])
        > var ag = agen(2)

        > await ag.next()
        { value: [ 4, [AsyncFunction: f00], 0, 0 ], done: false }
        > await ag.next()
        { value: [ 8, [AsyncFunction: f01], 0, 1 ], done: false }
        > await ag.next()
        { value: [ 11, [AsyncFunction: f10], 1, 0 ], done: false }
        > await ag.next()
        { value: [ 33, [AsyncFunction: f11], 1, 1 ], done: false }
        > await ag.next()
        { value: [ 35937, [AsyncFunction: f12], 1, 2 ], done: false }
        > await ag.next()
        { value: [ 71874, [AsyncFunction: f03], 0, 3 ], done: false }
        > await ag.next()
        { value: 71874, done: true }
        >

APIS

    const sync_l2r = (...funcs) => {
    const print_sync_l2r = (...fnames) => {
    const sync_r2l = (...funcs) => {
    const print_sync_r2l = (...fnames) => {
    const async_l2r = (...afuncs) => {
    const print_async_l2r = (...fnames) => {
    const async_r2l = (...funcs) => {
    const print_async_r2l = (...fnames) => {
    const _gen_l2r = function * (fary,depth=0) {
    const _gen_r2l = function * (fary,depth=0) {
    const sync_nest_l2r = (fary) => {
    const print_sync_nest_l2r = (fname_tree) =>{
    const sync_gen_nest_l2r = (fary)=> {
    const sync_nest_r2l = (fary) => {
    const print_sync_nest_r2l = (fname_tree) =>{
    const sync_gen_nest_r2l = (fary)=> {
    const async_nest_l2r = (ftree) => {
    const print_async_nest_l2r = (fname_tree) =>{
    const async_gen_nest_l2r = (ftree) => {
    const async_nest_r2l = (ftree) => {
    const print_async_nest_r2l = (fname_tree) =>{
    const async_gen_nest_r2l = (ftree) => {

METHODS

LICENSE

  • ISC