
Security News
November CVEs Fell 25% YoY, Driven by Slowdowns at Major CNAs
November CVE publications fell 25% YoY even as 2025 totals rose, showing how a few major CNAs can swing “global” counts and skew perceived risk.
@nrk/valg-valgomat-algoritme
Advanced tools
The algorithm used to calculate distance between sets of positions for NRKs Valgomat
Calculate the proximity of two sets of positions.
Calculates the proximity of two sets of positions. Mostly used to calculate the proximity of various party positions and a voter position.
The simple case is comparing to sets of positions.
import { proximity } from '@nrk/valg-valgomat-algoritme'
let partyPositions = {
id1: 1,
id2: -1
}
let voterPositions = {
id1: -2,
id2: 2
}
let p = proximity(partyPositions, voterPositions)
// => 0.25
The module also comes with a function to compare many positions to one position.
import { proximityMap } from '@nrk/valg-valgomat-algoritme'
let partyAPositions = {
id1: 1,
id2: -1
}
let partyBPositions = {
id1: 2,
id2: -2
}
let partyPostitions = {
partyA: partyAPositions,
partyB: partyBPositions
}
let voterPositions = {
id1: null,
id2: -2
}
let proximities = proximityMap(voterPositions, partyPositions)
// => { "partyA": 0.75, "partyB": 1.0 }
import { proximity, proximityMap } from '@nrk/valg-valgomat-algoritme'
Accepts two sets of positions and returns the proximity between them.
Positions are given in the form of sets:
{
[statement: string]: -2 | -1 | 1 | -2 | null
}
Output will be a number in the interval [0.0, 1.0] where 0.0 is the furthest away and 1.0 is the closest possible proximity (iow. identical).
If we are unable to determine a proximity, the output will be null. This happens if we are comparing a pair of vectors where one of the vectors are empty or there are no overlapping statements.
Accepts a set of positions and a map of many sets of positions and returns a map of the proximities between a position in the position map and the first position.
This is useful if you want to calculate the proximity of one set of positions and many sets of positions. For instance between all parties and a single voter.
Output will be a map from the keys in the positionsMap and the proximity to the given position.
npm install @nrk/valg-valgomat-algoritme
FAQs
The algorithm used to calculate distance between sets of positions for NRKs Valgomat
The npm package @nrk/valg-valgomat-algoritme receives a total of 53 weekly downloads. As such, @nrk/valg-valgomat-algoritme popularity was classified as not popular.
We found that @nrk/valg-valgomat-algoritme demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 183 open source maintainers collaborating on the project.
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.

Security News
November CVE publications fell 25% YoY even as 2025 totals rose, showing how a few major CNAs can swing “global” counts and skew perceived risk.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated “elf-*” npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.