JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q41922F
  • License ISC

coming soon

Package Exports

  • majinbuu

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (majinbuu) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Majin Buu

License: ISC Build Status Coverage Status donate

Apply the Levenshtein distance to transform / morph an Array into another, performing the least amount of needed .splice(...) operations.

const abra = ['a', 'b', 'r', 'a'];
majinbuu(abra, ['c', 'a', 'd', 'a', 'b', 'r', 'a']);

abra; // now ['c', 'a', 'd', 'a', 'b', 'r', 'a']

It is also possible to intercept all splice calls using an aura.

const abra = ['a', 'b', 'r', 'a'];
const interceptor = {
  splice(index, removal, ...items) {
    console.log(index, removal, ...items);
    abra.splice.apply(abra, arguments);
  }
};
const aura = majinbuu.aura(interceptor, abra);

majinbuu(aura, ['c', 'a', 'd', 'a', 'b', 'r', 'a']);
// 0 0 "c"
// 2 0 "d" "a"

Compatibility

Every. JavaScript. Engine.