Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@extra-array/selection-sort-update

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@extra-array/selection-sort-update

Arranges values in an order.

Source
npmnpm
Version
2.9.46
Version published
Maintainers
1
Created
Source

Arranges values in an order. :running: :vhs: :package: :moon: :ledger:

Alternatives: sort, sort$.
Similar: sort, merge.
This is part of package extra-array.

array.selectionSort$(x, [fc], [fm]);
// x:  an array (updated)
// fc: compare function (a, b)
// fm: map function (v, i, x)
// --> x
const array = require('extra-array');

var x = [-2, -3, 1, 4];
array.selectionSort$(x);
// [ -3, -2, 1, 4 ] (compares numbers)

x;
// [ -3, -2, 1, 4 ]

var x = [-2, -3, 1, 4];
array.selectionSort$(x, (a, b) => Math.abs(a) - Math.abs(b));
// [ 1, -2, -3, 4 ]

var x = [-2, -3, 1, 4];
array.selectionSort$(x, null, v => Math.abs(v));
// [ 1, -2, -3, 4 ]

references

Keywords

extra

FAQs

Package last updated on 20 Jun 2020

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