Comparing version
@@ -1,7 +0,12 @@ | ||
// Generated by CoffeeScript 1.4.0 | ||
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var fs, list; | ||
var fs, glob, list, path; | ||
fs = require('fs'); | ||
glob = require('glob'); | ||
path = require('path'); | ||
/** | ||
@@ -14,7 +19,6 @@ * @param {Array} paths Path or array of paths to iterate over | ||
* @return {Array} Files found | ||
*/ | ||
*/ | ||
module.exports = list = function() { | ||
var args, config, iterator, path, paths, results, _ref, _ref1; | ||
var args, config, iterator, paths, results, trypath; | ||
args = Array.prototype.slice.call(arguments); | ||
@@ -26,6 +30,6 @@ paths = args.shift(); | ||
config = typeof args[0] === 'object' && Object.keys(args[0]).length ? args.shift() : {}; | ||
if ((_ref = config.recurse) == null) { | ||
if (config.recurse == null) { | ||
config.recurse = false; | ||
} | ||
if ((_ref1 = config.match) == null) { | ||
if (config.match == null) { | ||
config.match = args[0] instanceof RegExp ? args.shift() : null; | ||
@@ -37,10 +41,12 @@ } | ||
results = []; | ||
while (path = paths.shift()) { | ||
fs.readdirSync(path).sort().forEach(function(file) { | ||
var self, _ref2; | ||
while (trypath = paths.shift()) { | ||
glob.sync(trypath, { | ||
nonegate: true | ||
}).forEach(function(file) { | ||
var self; | ||
self = { | ||
path: path, | ||
full: "" + path + "/" + file, | ||
file: file, | ||
name: (_ref2 = file.match(/^(.+?)(\.\w{2,7})?$/)) != null ? _ref2[1] : void 0 | ||
path: path.dirname(file), | ||
full: file, | ||
file: path.basename(file), | ||
name: path.basename(file, path.extname(file)) | ||
}; | ||
@@ -47,0 +53,0 @@ Object.defineProperty(self, "stat", { |
@@ -1,15 +0,18 @@ | ||
{ "name" : "ls" | ||
, "description" : "Cleanly traverse directories in Coffeescript & Javascript" | ||
, "author" : "Awnist <hi@awnist.com> (http://awnist.com)" | ||
, "version" : "0.0.2" | ||
, "main" : "./lib/ls" | ||
, "repository" : | ||
{ "type" : "git" | ||
, "url" : "http://github.com/awnist/ls.git" | ||
{ | ||
"name": "ls", | ||
"description": "Cleanly traverse directories in node", | ||
"author": "Awnist <hi@awnist.com> (http://awnist.com)", | ||
"version": "0.1.0", | ||
"main": "./lib/ls", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/awnist/ls.git" | ||
}, | ||
"license": { | ||
"type": "Public Domain", | ||
"url": "http://unlicense.org/" | ||
}, | ||
"dependencies": { | ||
"glob": "~4.0.2" | ||
} | ||
, "license" : | ||
{ "type" : "Public Domain" | ||
, "url" : "http://unlicense.org/" | ||
} | ||
} |
## What's "ls"? | ||
ls is a Coffeescript and Javascript module for cleanly traversing directories and listing files. | ||
ls is a node module for cleanly traversing directories and listing files. | ||
It has flexible and variable length arguments. | ||
The primary goal is a flexible, expressive syntax. | ||
@@ -20,3 +20,3 @@ ## Overview | ||
ls ["/path", "/another/path/"], { recurse: true }, /jpg/, -> | ||
ls ["/path/foo*", "/another/path/"], { recurse: true }, /jpg/, -> | ||
console.log @name, "is in", @path, "and is", @stat.size | ||
@@ -23,0 +23,0 @@ |
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
66
6.45%5632
-24.98%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added