array-slice-match

0.0.0 • Public • Published

TO BE DEFINED

(below is template only)

Whole repository is template for new Node.js TypeScript module. Download it and adapt to your needs.

About

This module extends Array prototype with additional methods:

  • xFindAllSlices() (x stands for custom, non-standard method)
$ npm i -S array-find-slice

Examples

Basic example

import 'array-find-slice';
let arr = ['x', 'A', 'B', 'x', 'x', 'x', 'A', 'B', 'x'];
arr.xFindAllSlices(['A', 'B']); // [['A', 'B'], ['A', 'B']]
arr.xFindAllSlices(['x', 'x']); // [['x', 'x']]
arr.xFindAllSlices(['x']); // [['x'], ['x'], ['x'], ['x'], ['x']]

Documentation

Array.prototype.xFindAllSlices(matcher: DeepPartial[], opts?: Array.XFindAllSlices_Opts)

Options

opts.fullMatch: boolean default false

  • if false (default) then array elements are compared with matcher elements using recursive deep partial match deep-match2.
  • if true then array elements are compared with matcher elements using deep-equal. In case of fullMatch=true TypeScript forces matcher to be non-partial T[].

/array-slice-match/

    Package Sidebar

    Install

    npm i array-slice-match

    Weekly Downloads

    1

    Version

    0.0.0

    License

    TODO-LICENSE

    Unpacked Size

    229 kB

    Total Files

    7

    Last publish

    Collaborators

    • fider