JSPM

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

Filter a XY array based on x values

Package Exports

  • ml-array-xy-filter-x

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

Readme

array-xy-filter-x

NPM version npm download

Sort a set of point based on the abscissas values.

Installation

$ npm install --save ml-array-xy-filter-x

Usage

import filterX from 'ml-array-xy-filter-x';

  const x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  const y = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
  const points = { x, y };

let result = filterX(points, {
    from: 2.5,
    to: 8.5,
    exclusions: [{ from: 2, to: 4.5 }, { from: 5.5, to: 8 }]
});

/* result -> {
    x: [5, 8],
    y: [6, 9]
} */

License

MIT