Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

quipu-math

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

quipu-math

Mathematics of Incan knotted cord (quipu) data structures for JavaScript/TypeScript

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
14
-90.21%
Maintainers
1
Weekly downloads
 
Created
Source

quipu-math

Mathematics of Incan knotted cord (quipu) data structures for JavaScript/TypeScript.

Quipu are Incan knotted cord recording devices. This package implements the mathematics of knotted data structures: encoding numbers as knot sequences, building cord hierarchies, arithmetic on quipus, and error detection via parity knots.

Ported from the Python quipu-math package.

Install

npm install quipu-math

Usage

import { encodeNumber, decodeKnots, Cord, CordTree, addQuipus } from "quipu-math";

// Encode a number as a knot sequence
const knots = encodeNumber(247);

// Decode back
const n = decodeKnots(knots); // 247

// Build a cord tree
const tree = new CordTree();
tree.addPendant(new Cord("red", encodeNumber(100)));
tree.addPendant(new Cord("blue", encodeNumber(47)));

// Quipu arithmetic
const result = addQuipus(tree, otherTree);

API

  • knot: encodeNumber(n), decodeKnots(knots), checksum(knots)
  • cord: Cord class with addKnot, serialize(), deserialize(json), CordTree class with addPendant, traverse()
  • weave: weave(cord1, cord2), unweave(cord), isAssociative(a, b, c)
  • arithmetic: addQuipus(t1, t2), subtractQuipus(t1, t2), multiplyQuipus(t1, t2)
  • detect: detectCorruption(original, copy)CorruptionReport

Test

npm test

MIT License

Keywords

quipu

FAQs

Package last updated on 01 Jun 2026

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