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-data-fullmesh

v1.0.1

Published

full-mesh,mesh-map,sender-recver

Downloads

1

Readme

nv-data-fullmesh

  • normal map cant send msg between map-elements
  • nv-data-fullmesh creat a full-meshed(a-link-between-eachother) map

install

  • npm install nv-data-fullmesh

usage

const {Mesh} = require("nv-data-fullmesh");

###init

var cfg = {
    'd':{},
    'a':[],
    'm':new Map(),
    'n':0,
    'f':()=>{},
    's':"str",
}
var mesh = new Mesh(cfg);
> mesh
Map {
  'd' => {},
  'a' => [],
  'm' => Map {},
  'n' => 0,
  'f' => [Function: f],
  's' => str
}
>
> mesh.ls()
[ 'd', 'a', 'm', 'n', 'f', 's' ]
>

> mesh.a
[]
> mesh.d
{}
> mesh.f
[Function: f]
> mesh.m
Map {}
> mesh.n
0
>

repr and data

> mesh.a.data.push(100)
1
> mesh.a
[ 100 ]
> mesh.a.data           //use .data to take real-data
[ 100 ]
>

send and recv message between nodes

mesh.a.recv_from_handler = (src,msg,self) => {console.log(src,msg,self)}
> mesh.d.id
'd'
>

mesh.d.send_to(mesh.a,"hello!")
> mesh.d.send_to(mesh.a,"hello! i am "+mesh.d.id)
{} hello! i am d [100]
undefined
>
Array.from(mesh).forEach(nd=>{nd.recv_from_handler=(src,msg,self) => {console.log(src,msg,self)}})
> mesh.a.broadcast("hi,every one")
[ 100 ] hi,every one {}
[ 100 ] hi,every one Map {}
[ 100 ] hi,every one 0
[ 100 ] hi,every one [Function: f]
[ 100 ] hi,every one str
undefined
>

> mesh.a.multicast([mesh.d,mesh.m],"youe are objects!!")
[ 100 ] youe are objects!! {}
[ 100 ] youe are objects!! Map {}
undefined
>

send and recv between controller(mesh) and nodes

mesh.recv_from_nd_handler = (src,msg,self)=>{console.log(src,msg)}

Array.from(mesh).forEach(nd=>{nd.recv_from_ctrl_handler=(ctrl,msg,self) => {console.log(msg,self)}})
> mesh.broadcast("whos is function?")
whos is function? {}
whos is function? [ 100 ]
whos is function? Map {}
whos is function? 0
whos is function? [Function: f]
whos is function? str
undefined
>

> mesh.f.send_to_ctrl("i am")
[Function: f] i am
undefined
>

rm/add(on mesh) disconn(on node)

> mesh.rm('f')
[Function: f]
> mesh.ls()
[ 'd', 'a', 'm', 'n', 's' ]
>
> mesh.add(WeakMap,'c')
[Function: WeakMap]
>
> mesh
Map {
  'd' => {},
  'a' => [ 100 ],
  'm' => Map {},
  'n' => 0,
  's' => str,
  'c' => [Function: WeakMap]
}
>

> mesh
Map {
  'd' => {},
  'a' => [ 100 ],
  'm' => Map {},
  'n' => 0,
  's' => str,
  'c' => [Function: WeakMap]
}
> mesh.c.disconn()
[Function: WeakMap]
> mesh
Map { 'd' => {}, 'a' => [ 100 ], 'm' => Map {}, 'n' => 0, 's' => str }
>

adj/neighbors

> mesh.a.$$.d === mesh.d
true
> mesh.a.$$.m === mesh.m
true
>

> mesh.a.neighbors()
{ d: {}, m: Map {}, n: 0, f: [Function: f], s: str }
>
>

METHODS

MESH (controller)

mesh.add                   mesh.broadcast             
mesh.init_with_array       mesh.init_with_dict
mesh.init_with_map         mesh.length                
mesh.ls                    mesh.multicast             
mesh.recv_from_nd_handler  mesh.rm                    
mesh.send_to               mesh.to_dict               
mesh.to_map                mesh.to_weakmap

NODE

mesh.a.$$                      mesh.a.broadcast               
mesh.a.data                    mesh.a.disconn                 
mesh.a.id                      mesh.a.multicast               
mesh.a.neighbors               mesh.a.recv_from_ctrl_handler  
mesh.a.recv_from_handler       mesh.a.send_to                 
mesh.a.send_to_ctrl

APIS

  • nvmesh.ERROR_DICT

LICENSE

  • ISC