markdown-folder-to-html
Version:
Convert a folder with files and markdown documents to an HTML site
17 lines (16 loc) • 537 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const isPreferent = (x, preferences) => preferences.indexOf(x) > -1;
const strSort = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
function sortByPrecedence(preferences, a, b) {
const aPref = isPreferent(a, preferences);
const bPref = isPreferent(b, preferences);
return aPref && bPref
? strSort(a, b)
: aPref
? -1
: bPref
? 1
: strSort(a, b);
}
exports.default = sortByPrecedence;