Socket
Socket
Sign inDemoInstall

@confuzzle/move-to-front

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @confuzzle/move-to-front

naive Move-to-front transform


Version published
Maintainers
1
Install size
2.36 kB
Created

Readme

Source

@confuzzle/move-to-front

This package contains a naive, inefficient implementation of the Move-to-front transform.

For details of how this can be used together with the Burrows-Wheeler transform to improve compression, see this excellent blog post by Tommy Reddad.

See also

Functionality

This package provides two functions:

  • forward(s), which runs Buffer.from(s) and performs the forward transform on the result
  • inverse(x), which runs Buffer.from(x) performs the inverse transform on the result Both functions return a Buffer object.

Example Usage

const mtf = require('@confuzzle/move-to-front');
const s = 'abracadabra';
const t = mtf.forward(s);
const inv = mtf.inverse(t).toString();
console.log(inv) // abracadabra

Keywords

FAQs

Last updated on 31 Jan 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc