
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
vfile-sort
Advanced tools
vfile
utility to sort files or messages.
This package exposes comparators for vfile files and messages.
You can use this right before a reporter is used to give humans a coherent report.
This package is ESM only. In Node.js (version 16+), install with npm:
npm install vfile-sort
In Deno with esm.sh
:
import {sort} from 'https://esm.sh/vfile-sort@4'
In browsers with esm.sh
:
<script type="module">
import {sort} from 'https://esm.sh/vfile-sort@4?bundle'
</script>
import {VFile} from 'vfile'
import {VFileMessage} from 'vfile-message'
import {compareFile, compareMessage} from 'vfile-sort'
console.log(
[
new VFileMessage('Error!', {place: {line: 3, column: 1}}),
new VFileMessage('Another!', {place: {line: 2, column: 2}})
]
.toSorted(compareMessage)
.map(String)
) //=> ['2:2: Another!', '3:1: Error!']
console.log(
[
new VFile(new URL(import.meta.url)),
new VFile(new URL('.', import.meta.url))
]
.toSorted(compareFile)
.map((d) => d.path)
) //=> ['/Users/tilde/Projects/oss/vfile-sort/', '/Users/tilde/Projects/oss/vfile-sort/example.js']
This package exports the identifiers compareFile
and
compareMessage
.
There is no default export.
compareFile(a, b)
Compare files (since: 4.0.0
).
Order (number
).
compareMessage(a, b)
Compare messages (since: 4.0.0
).
It first sorts by line/column: earlier messages come first.
When two messages occurr at the same place, sorts fatal error before
warnings, before info messages.
Finally, it sorts using localeCompare
on source
, ruleId
, or finally
reason
.
Order (number
).
This package is fully typed with TypeScript. It exports no additional types.
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, vfile-sort@^4
,
compatible with Node.js 16.
See contributing.md
in vfile/.github
for ways to
get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
FAQs
vfile utility to sort messages by line/column
The npm package vfile-sort receives a total of 479,544 weekly downloads. As such, vfile-sort popularity was classified as popular.
We found that vfile-sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.