vfile-sort
Advanced tools
Comparing version 2.0.0 to 2.1.0
23
index.js
@@ -1,15 +0,12 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module vfile-sort | ||
* @fileoverview Sort vfile messages by line/column. | ||
*/ | ||
'use strict'; | ||
/* Expose. */ | ||
module.exports = sort; | ||
/* Sort all `file`s messages by line/column. */ | ||
var severities = { | ||
true: 2, | ||
false: 1, | ||
null: 0, | ||
undefined: 0 | ||
}; | ||
function sort(file) { | ||
@@ -20,10 +17,10 @@ file.messages.sort(comparator); | ||
/* Comparator. */ | ||
function comparator(a, b) { | ||
return check(a, b, 'line') || check(a, b, 'column') || -1; | ||
var left = severities[a.fatal]; | ||
var right = severities[b.fatal]; | ||
return check(a, b, 'line') || check(a, b, 'column') || right - left || -1; | ||
} | ||
/* Compare a single property. */ | ||
function check(a, b, property) { | ||
return (a[property] || 0) - (b[property] || 0); | ||
} |
{ | ||
"name": "vfile-sort", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Sort vfile messages by line/column", | ||
@@ -11,4 +11,4 @@ "license": "MIT", | ||
], | ||
"repository": "https://github.com/wooorm/vfile-sort", | ||
"bugs": "https://github.com/wooorm/vfile-sort/issues", | ||
"repository": "https://github.com/vfile/vfile-sort", | ||
"bugs": "https://github.com/vfile/vfile-sort/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
@@ -23,13 +23,13 @@ "contributors": [ | ||
"devDependencies": { | ||
"browserify": "^13.0.1", | ||
"browserify": "^14.0.0", | ||
"esmangle": "^1.0.1", | ||
"nyc": "^8.1.0", | ||
"remark-cli": "^2.0.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"nyc": "^11.0.0", | ||
"remark-cli": "^3.0.0", | ||
"remark-preset-wooorm": "^3.0.0", | ||
"tape": "^4.0.0", | ||
"vfile": "^2.0.0", | ||
"xo": "^0.16.0" | ||
"xo": "^0.18.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . --quiet --frail", | ||
"build-md": "remark . -qfo", | ||
"build-bundle": "browserify index.js --bare -s vfileSort > vfile-sort.js", | ||
@@ -51,2 +51,3 @@ "build-mangle": "esmangle vfile-sort.js > vfile-sort.min.js", | ||
"space": true, | ||
"esnext": false, | ||
"ignores": [ | ||
@@ -57,5 +58,6 @@ "vfile-sort.js" | ||
"remarkConfig": { | ||
"output": true, | ||
"presets": "wooorm" | ||
"plugins": [ | ||
"preset-wooorm" | ||
] | ||
} | ||
} |
@@ -42,9 +42,9 @@ # vfile-sort [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
[travis-badge]: https://img.shields.io/travis/wooorm/vfile-sort.svg | ||
[travis-badge]: https://img.shields.io/travis/vfile/vfile-sort.svg | ||
[travis]: https://travis-ci.org/wooorm/vfile-sort | ||
[travis]: https://travis-ci.org/vfile/vfile-sort | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/vfile-sort.svg | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-sort.svg | ||
[codecov]: https://codecov.io/github/wooorm/vfile-sort | ||
[codecov]: https://codecov.io/github/vfile/vfile-sort | ||
@@ -57,2 +57,2 @@ [npm]: https://docs.npmjs.com/cli/install | ||
[vfile]: https://github.com/wooorm/vfile | ||
[vfile]: https://github.com/vfile/vfile |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4039
20