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

pairing

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pairing

Number pairing functions with support for BigInt numbers.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
decreased by-93.83%
Maintainers
1
Weekly downloads
 
Created
Source

Pairing

Number pairing functions with support for BigInt numbers.

Build Status npm version

Features
  • Simple API;
  • Works with plain numbers or BigInt;
  • Extensive tests;
  • Typescript support.

Installation

npm install pairing
Requirements
  • Node.js v.14+

Quick start

import { elegant } from 'pairing';

// encode bigint numbers
const z = elegant.encode(3037000499n, 2891526307n); // returns 9223372036854775807n

// decode bigint number
const [x, y] = elegant.decode(9223372036854775807n); // returns [3037000499n, 2891526307n]

Supported pairing functions

Motivation

Pairing functions are magic. They encode two natural numbers into a derivative natural. This can be useful in various use-cases, such as optimizing compound numeric indices.

At the time of writing, none of the existing libraries in npm supported BigInt calculations. Types were also missing.

We are hiring

Causaly is building the world's largest biomedical knowledge platform, using technologies such as TypeScript, React and Node.js. Find out more about our openings at https://apply.workable.com/causaly/.

License

MIT

Keywords

FAQs

Package last updated on 11 Mar 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