JSPM

ldm-partition

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q37542F
  • License MIT

Largest differencing method

Package Exports

  • ldm-partition
  • ldm-partition/index.js

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 (ldm-partition) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JavaScript implementation for largest differencing method

Implementation based on algorithm invented by Narendra Karmarkar and Richard M. Karp.

Install

npm install ldm-partition

Usage

import partition from 'ldm-partition';

partition([8, 7, 6, 5, 4], 2);
//=> [[4, 7, 5], [8, 6]]

partition([{ x: 2 }, { x: 4 }], 2, (d) => d.x));
//=> [[{ x: 4 }], [{ x: 2 }]]