serve-index
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -0,1 +1,7 @@ | ||
1.4.0 / 2014-10-03 | ||
================== | ||
* Add `dir` argument to `filter` function | ||
* Support using tokens multiple times | ||
1.3.1 / 2014-10-01 | ||
@@ -2,0 +8,0 @@ ================== |
12
index.js
@@ -145,3 +145,5 @@ | ||
if (!hidden) files = removeHidden(files); | ||
if (filter) files = files.filter(filter); | ||
if (filter) files = files.filter(function(filename, index, list) { | ||
return filter(filename, index, list, path); | ||
}); | ||
files.sort(); | ||
@@ -176,6 +178,6 @@ | ||
str = str | ||
.replace('{style}', style.concat(iconStyle(files, icons))) | ||
.replace('{files}', html(files, dir, icons, view)) | ||
.replace('{directory}', dir) | ||
.replace('{linked-path}', htmlPath(dir)); | ||
.replace(/\{style\}/g, style.concat(iconStyle(files, icons))) | ||
.replace(/\{files\}/g, html(files, dir, icons, view)) | ||
.replace(/\{directory\}/g, dir) | ||
.replace(/\{linked-path\}/g, htmlPath(dir)); | ||
@@ -182,0 +184,0 @@ var buf = new Buffer(str, 'utf8'); |
{ | ||
"name": "serve-index", | ||
"description": "Serve directory listings", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -38,3 +38,7 @@ # serve-index | ||
Apply this filter function to files. Defaults to `false`. | ||
Apply this filter function to files. Defaults to `false`. The `filter` function | ||
is called for each file, with the signature `filter(filename, index, files, dir)` | ||
where `filename` is the name of the file, `index` is the array index, `files` is | ||
the array of files and `dir` is the absolute path the file is located (and thus, | ||
the directory the listing is for). | ||
@@ -41,0 +45,0 @@ ##### hidden |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85633
751
128