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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nv-facutil-window

v1.0.1

Published

nv-facutil-window ======================== - window for array OR generator OR async-generator - its a simple version of nv-facutil-cache-cursor(win) AND nv-facutil-fixed-cache-cursor(win7) - win window-of-any-size - win7 window-of-size-7 , this is s

Downloads

6

Readme

nv-facutil-window

  • window for array OR generator OR async-generator
  • its a simple version of nv-facutil-cache-cursor(win) AND nv-facutil-fixed-cache-cursor(win7)
  • win window-of-any-size
  • win7 window-of-size-7 , this is same as win, just fast

install

  • npm install nv-facutil-window

usage

     const {win7,win} = require("nv-facutil-window");

example

win

arygen

    var arr = Array.from('abcdefghijklmnopqrst')

    var g = win.arygen(arr,9,undefined)

    var w = (g.next().value)

    /*
    > w
    Proxy [
      [
        undefined, undefined,
        undefined, undefined,
        'a',       undefined,
        undefined, undefined,
        undefined
      ],
      { get: [Function: get], set: [Function: set] }
    ]
    >
    > w[0]
    'a'
    >

    */

    (g.next().value)
    (g.next().value)
    (g.next().value)

    /*
    > w
    Proxy [
      [
        undefined, undefined,
        undefined, undefined,
        'a',       'b',
        'c',       'd',
        undefined
      ],
      { get: [Function: get], set: [Function: set] }
    ]
    >
    > w[0]
    'a'
    > w[1]
    'b'
    > w[2]
    'c'
    > w[3]
    'd'
    >

    */
    (g.next().value)
    (g.next().value)
    (g.next().value)

    /*
    > w
    Proxy [
      [
        undefined, undefined,
        'a',       'b',
        'c',       'd',
        'e',       'f',
        'g'
      ],
      { get: [Function: get], set: [Function: set] }
    ]
    >
    > w[0]
    'c'
    > w[1]
    'd'
    > w[2]
    'e'
    > w[-1]
    'b'
    > w[-2]
    'a'
    > w[-3]
    undefined
    >

    */

    (g.next().value)
    (g.next().value)
    (g.next().value)

    /*
    > w
    Proxy [
      [
        'b', 'c', 'd',
        'e', 'f', 'g',
        'h', 'i', 'j'
      ],
      { get: [Function: get], set: [Function: set] }
    ]
    >
    > w[0]
    'f'
    >

    */
    
    (g.next().value)
    (g.next().value)
    (g.next().value)
    (g.next().value)
    (g.next().value)
    (g.next().value)
    (g.next().value)
    (g.next().value)
    (g.next().value)
    (g.next().value)        
    
    /*
    > w
    Proxy [
      [
        'l', 'm', 'n',
        'o', 'p', 'q',
        'r', 's', 't'
      ],
      { get: [Function: get], set: [Function: set] }
    ]
    >
    > w[0]
    'p'
    >
    > w[-1]
    'o'
    > w[1]
    'q'
    >

    */

    /*
    > (g.next().value)
    >

    */

sgen for sync-generator

   var arr = Array.from('abcdefghijklmnopqrst');
   var sg = arr[Symbol.iterator]()
   var g = win.sgen(sg,9,undefined)
   var w = (g.next().value)

agen for async-generator

        const { setTimeout: setTimeoutPromise } = require('timers/promises');

        async function* tst() {
            while(true) {
                let v = await setTimeoutPromise(Math.random()*3000,Math.random());
                yield(v)
            }
        }

        var _ag = tst()


        var ag = win.agen(_ag,9,undefined)

        var w = ((await ag.next()).value)
        ((await ag.next()).value)
        ((await ag.next()).value)
        ((await ag.next()).value)
        ((await ag.next()).value)
        ((await ag.next()).value)
        ((await ag.next()).value)

        /*
        > w
        Proxy [
          [
            undefined,
            undefined,
            0.28107788433183,
            0.9608738564529793,
            0.10110530569335863,
            0.11198834195645557,
            0.17351639773279026,
            0.9778673105025262,
            0.697258589472074
          ],
          { get: [Function: get], set: [Function: set] }
        ]
        > w[0]
        0.10110530569335863
        >
        > w[-1]
        0.9608738564529793
        > w[-2]
        0.28107788433183
        > w[-3]
        undefined
        > w[1]
        0.11198834195645557
        > w[2]
        0.17351639773279026
        > w[3]
        0.9778673105025262
        > w[4]
        0.697258589472074
        > w[5]
        undefined
        >


        */

gen wrap of arygen AND sgen

creat wrap of gen AND agen

win7 same as win ,just for performance

METHODS

win7

getter /setter

 .ppp_      [-3]
 .pp_       [-2]
 .prev_     [-1]
 .curr_     [0]
 .next_     [1]
 .nn_       [2]
 .nnn_      [3]   

getter

 .ary_  

API

win

    function * arygen(arr,size=9,empty=undefined) {
    function * sgen (g,size=9,empty=undefined) {
    function * gen(iter,size=9,empty=undefined) {
    async function * agen(ag,size=9,empty=undefined) {

win7

    function * arygen(arr,empty=undefined) {
    function * sgen (g,empty=undefined) {
    function * gen(iter,empty=undefined) {
    async function * agen(ag,empty=undefined) {

cmmn

const get_mid_idx = (size) => {
const is_ag = (f)=>f[Symbol.toStringTag]==='AsyncGenerator';

LICENSE

  • ISC