vfile-sort

vfile utility to sort messages by line/column

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
vfile-sort
403.0.02 years ago7 years agoMinified + gzip package size for vfile-sort in KB

Readme

vfile-sort
!Buildbuild-badgebuild !Coveragecoverage-badgecoverage !Downloadsdownloads-badgedownloads !Sizesize-badgesize !Sponsorssponsors-badgecollective !Backersbackers-badgecollective !Chatchat-badgechat
Sort vfile messages.
  • First sorts by line/column: earlier messages come first
  • If two messages occurred at the same place, sorts fatal error before
warnings, before info messages
  • Otherwise, uses localeCompare to compare source, ruleId, or finally
`reason`

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.
npm install vfile-sort
## Use

```js
import {VFile} from 'vfile'
import {sort} from 'vfile-sort'

var file = VFile()

file.message('Error!', {line: 3, column: 1})
file.message('Another!', {line: 2, column: 2})

sort(file)

console.log(file.messages.map(d => String(d)))
// => ['2:2: Another!', '3:1: Error!']

API

This package exports the following identifiers: sort. There is no default export.

sort(file)

Sort messages in the given vfile.

Contribute

See contributing.mdcontributing in vfile/.githubhealth for ways to get started. See support.mdsupport for ways to get help.
This project has a code of conductcoc. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MITlicense © Titus Wormerauthor