Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rei-network/utils

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rei-network/utils

[![NPM Version](https://img.shields.io/npm/v/@rei-network/utils)](https://www.npmjs.org/package/@rei-network/utils) ![License](https://img.shields.io/npm/l/@rei-network/utils)

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

@rei-network/utils

NPM Version License

Utils include the following classes:

  • Channel: Contains three implements
    • Channel: An asynchronous queue, order by the order in which the elements are pushed
    • HChannel: An asynchronous queue, order by customizable heap
    • PChannel: An asynchronous queue, order by element index(grow from 0) and index must be continuous
  • Compress: Provide some functions for compressing and decompressing data
  • FunctionalMap and FunctionalSet: Key customizable map and set

INSTALL

npm install @rei-network/utils

USAGE

const channel = new Channel<string>();
channel.push("123");
channel.push("456");
setTimeout(() => {
  channel.push("789");
}, 1000);
setTimeout(() => {
  channel.push("101112");
}, 2000);
setTimeout(() => {
  channel.abort();
}, 3000);

(async () => {
  for await (const data of channel.generator()) {
    console.log("data:", data);
  }
  console.log("channel end");
})();
const bufferMap = new FunctionalMap<Buffer, string>((a: Buffer, b: Buffer) =>
  a.compare(b)
);
bufferMap.set(Buffer.from("aaaaaa", "hex"), "aaaaaa");
console.log(bufferMap.get(Buffer.from("aaaaaa", "hex")) === "aaaaaa"); // true

License

GNU General Public License v3.0

FAQs

Package last updated on 01 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc