Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-segments

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-segments

Finds element segments matches in an array

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

array-segments

Finds element segments matches in an array.

Usage

const array_segments = require('array-segments');

let res

res = array_segments.match(
    ['a', 'b', 'c', 'd', 'e', 'f', 'a', 'z', 'a', 'b'],
    [
        ['c', 'd', 'e'],
        ['b', 'c', 'd', 'e'],
        ['a', 'z'],
        ['a', 'b'],
        ['a']
    ])

console.log(res)
// [ { segment: [ 'c', 'd', 'e' ], indices: [ 2 ] },
//   { segment: [ 'a', 'z' ], indices: [ 6 ] },
//   { segment: [ 'a', 'b' ], indices: [ 0, 8 ] } ]

// Case insensitive match
res = array_segments.match(
    ['a', 'b', 'c', 'D', 'E', 'f', 'a', 'z', 'a', 'b'],
    [
        ['C', 'd', 'E'],
        ['b', 'c', 'd', 'e'],
        ['a', 'z'],
        ['a', 'b'],
        ['a']
    ],
    true)

console.log(res)
// [ { segment: [ 'c', 'd', 'e' ], indices: [ 2 ] },
//   { segment: [ 'a', 'z' ], indices: [ 6 ] },
//   { segment: [ 'a', 'b' ], indices: [ 0, 8 ] } ]

Contributions

Pull Requests and contributions in general are welcome as long as they follow the Node aesthetic.

Keywords

FAQs

Package last updated on 21 Aug 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc