diff --git a/lib/kody.js b/lib/kody.js index 5f24b9f..c65286a 100644 --- a/lib/kody.js +++ b/lib/kody.js @@ -164,13 +164,15 @@ processTasks = function processTasks(tasks) { /** * used to sort ordering of task files based on desire. * - * @param {string} a - string representing task filename - * @param {string} b - string representing task filename + * @param {string} a - string representing task filepath + * @param {string} b - string representing task filepath * @returns {bool} - used by Array.sort */ sortFiles = function sortFiles(a, b) { - var aIndex = rc.order.indexOf(a), - bIndex = rc.order.indexOf(b); + var taskA = a.substring(a.lastIndexOf('/') + 1), + taskB = b.substring(b.lastIndexOf('/') + 1), + aIndex = rc.order.indexOf(taskA), + bIndex = rc.order.indexOf(taskB); if (bIndex !== -1 && aIndex !== -1 && aIndex < bIndex) return -1; if (aIndex !== -1 || bIndex !== -1) return 1; }, diff --git a/package.json b/package.json index 3fd57ba..7008180 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "kody", "description": ".files in node", - "version": "1.0.1", + "version": "1.1.1", "main": "index.js", "homepage": "https://github.com/jh3y/kody", "author": { diff --git a/src/lib/kody.js b/src/lib/kody.js index 4ca5ab0..7bc321d 100644 --- a/src/lib/kody.js +++ b/src/lib/kody.js @@ -98,13 +98,15 @@ const PROPS = { /** * used to sort ordering of task files based on desire. * - * @param {string} a - string representing task filename - * @param {string} b - string representing task filename + * @param {string} a - string representing task filepath + * @param {string} b - string representing task filepath * @returns {bool} - used by Array.sort */ sortFiles = function(a, b) { - const aIndex = rc.order.indexOf(a), - bIndex = rc.order.indexOf(b); + const taskA = a.substring(a.lastIndexOf('/') + 1), + taskB = b.substring(b.lastIndexOf('/') + 1), + aIndex = rc.order.indexOf(taskA), + bIndex = rc.order.indexOf(taskB); if (bIndex !== -1 && aIndex !== -1 && aIndex < bIndex) return -1; if (aIndex !== -1 || bIndex !== -1)