Socket
Socket
Sign inDemoInstall

sorted-paired-zip

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sorted-paired-zip

Provides a function which zips array elements together in pairs using a custom sort function


Version published
Weekly downloads
360
increased by52.54%
Maintainers
1
Install size
7.65 kB
Created
Weekly downloads
 

Readme

Source

Sorted paired zip

A JavaScript function which zips array elements together in pairs using a custom sort function

Install

npm install --save sorted-paired-zip

Examples

const { sortedPairedZip } = require('sorted-paired-zip');

const sorter = (x, y) => x.localeCompare(y);
sortedPairedZip(['a', 'b', 'c', 'e'], ['b', 'c', 'd', 'e', 'f'], sorter) === [
  ['a', null],
  ['b', 'b'],
  ['c', 'c'],
  [null, 'd'],
  ['e', 'e'],
  [null, 'f']
];

const sorter = (x, y) => x - y;
sortedPairedZip([4, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8], sorter) === [
  [null, 1],
  [null, 2],
  [null, 3],
  [4, 4],
  [null, 5],
  [null, 6],
  [7, 7],
  [8, 8]
];

Keywords

FAQs

Last updated on 07 Sep 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc