Installations
npm install quickselect.js
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
12.16.1
NPM Version
6.14.5
Score
68.3
Supply Chain
86.3
Quality
75.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
mbalabash
Download Statistics
Total Downloads
1,256
Last Day
1
Last Week
11
Last Month
36
Last Year
123
GitHub Statistics
11 Commits
3 Watching
3 Branches
1 Contributors
Bundle Size
907.00 B
Minified
447.00 B
Minified + Gzipped
Package Meta Information
Latest Version
0.1.4
Package Id
quickselect.js@0.1.4
Unpacked Size
6.25 kB
Size
2.78 kB
File Count
9
NPM Version
6.14.5
Node Version
12.16.1
Total Downloads
Cumulative downloads
Total Downloads
1,256
Last day
0%
1
Compared to previous day
Last week
57.1%
11
Compared to previous week
Last month
620%
36
Compared to previous month
Last year
-9.6%
123
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Quickselect implementation on javascript.
Finding the k-th smallest element in an unsorted list.
See: https://en.wikipedia.org/wiki/Quickselect
Api
1/** 2 * @param {Array} array - Data 3 * @param {Number} k - Position of smallest element (starts from 0) 4 * @param {Function} accessor - Function which return value for processing (optional) 5 */ 6const element = quickSelect(array, k, accessor)
Install:
1npm i quickselect.js
or
1yarn add quickselect.js
Usage:
1const data = [7, 10, 4, 3, 20, 15] 2const k = 2 3const element = quickSelect(data, k) 4console.log(element) // 7
or
1const dataWithObjects = [ 2 { value: 7 }, 3 { value: 10 }, 4 { value: 4 }, 5 { value: 3 }, 6 { value: 20 }, 7 { value: 15 }, 8] 9const k = 2 10const element = quickSelect(dataWithObjects, k, item => item.value) 11console.log(element) // { value: 7 }
Median by quickselect:
1const quickSelectMedian = array => { 2 const { length } = array 3 if (length % 2) { 4 return quickSelect(array, length / 2) 5 } 6 return ( 7 0.5 * (quickSelect(array, length / 2 - 1) + quickSelect(array, length / 2)) 8 ) 9}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/7 approved changesets -- score normalized to 0
Reason
project is archived
Details
- Warn: Repository is archived.
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Reason
25 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-px4h-xg32-q955
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More