From d6677e7314791a18edf33497428c524cd5d39230 Mon Sep 17 00:00:00 2001 From: Micah Stubbs Date: Wed, 17 Jul 2019 22:59:47 -0700 Subject: [PATCH] sort the json and plaintext response types as well --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index cee1edb3..270ad333 100644 --- a/index.js +++ b/index.js @@ -217,13 +217,13 @@ serveIndex.html = function _html(req, res, files, next, dir, showUp, icons, path * Respond with application/json. */ -serveIndex.json = function _json (req, res, files, next, dir, showUp, icons, path) { +serveIndex.json = function _json (req, res, files, next, dir, showUp, icons, path, sort) { // stat all files stat(path, files, function (err, fileList) { if (err) return next(err) // sort file list - fileList.sort(fileSort) + fileList.sort(sort) // serialize var body = JSON.stringify(fileList.map(function (file) { @@ -238,13 +238,13 @@ serveIndex.json = function _json (req, res, files, next, dir, showUp, icons, pat * Respond with text/plain. */ -serveIndex.plain = function _plain (req, res, files, next, dir, showUp, icons, path) { +serveIndex.plain = function _plain (req, res, files, next, dir, showUp, icons, path, sort) { // stat all files stat(path, files, function (err, fileList) { if (err) return next(err) // sort file list - fileList.sort(fileSort) + fileList.sort(sort) // serialize var body = fileList.map(function (file) {