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

@chix/group

v2.9.14

Published

Chiχ Group

Downloads

27

Readme

Build Status

Chiχ Group

Example

// Sending component
const Group = require('chix-group/send')
const g = Group.create()
output({out: g.open()})
output({out: g.write(packet)})
output({out: g.write(packet)})
output({out: g.write(packet)})
output({out: g.write(packet)})
output({xout: g.close()})

// Receiving component
const Group = require('chix-group/recv')
const g = Group.create()
g.on('group', (groupData) => {
  output({out: $.create(groupData)})
})

g.receive(p) <-- group start packet
g.add(p) <-- item packet
g.add(p) <-- item packet
g.receive(p) <-- group end packet

if (g.isComplete()) {
}

groupBy

Creates SubGroups from incoming groups This works even when the packets are out of order.

Receives a differentiator for the itemId specified within the metadata of the received packet.

This meta data contains an itemId for a specific input group.

This itemId will have to correspond with the received packets on the other port.

When the grouping is done, the collected subgroups are emitted along with their differentiator

This data can be used to send out the groups again.

The groups will be emitted only after all subgroups are complete.

const groupBy = require('chix-group/groupBy')

// .. sending node

// receive open packet
groupBy.receive(p)

// receive packet with differentiator
groupBy.setBy(p)

// receive packet incoming packet
groupBy.add(p)

// Listen for group event
// group is an array of data, by is the differentiator
groupBy.on('group', (group, by) => {
  console.log(group, by)
})

Sync

Sync is used to synchronize at least 2 different inputs where both input paths originate from the same group, yet went different paths.

Sync can be used to synchronise the paths again and send out the items in order.

const Sync = require('chix-group/sync')

const sync = Sync(['in1', 'in2'], /* ordered (true|false) */)

// .. sending node

// receive open packet
sync.receive(p)

// receive packet from port in1
sync.add('in1', p)

// receive packet from port in2
sync.add('in2', p)

// some more packets
sync.add('in2', p)
sync.add('in1', p)
sync.add('in2', p)
sync.add('in1', p)
sync.receive(p) // receive close packet
sync.add('in1', p)
sync.add('in2', p)


// If ordered is true (the default) a group event is emitted
// which contains all items in order
sync.on('group', (group) => {
  console.log(group)
})

// both for unordered and ordered a sync event is emitted
// if ordered is true (the default) the events are emitted in order.
// else the events are emitted as soon as a combination of packets is ready,
// the item order of the original group in this case will not be garanteed.
sync.on('sync', (itemId, val) => {
  console.log(itemId, val)
})