findup-sync
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2012 "Cowboy" Ben Alman | ||
* Copyright (c) 2013 "Cowboy" Ben Alman | ||
* Licensed under the MIT license. | ||
@@ -27,3 +27,3 @@ */ | ||
globOptions.maxDepth = 1; | ||
globOptions.cwd = path.resolve(globOptions.cwd); | ||
globOptions.cwd = path.resolve(globOptions.cwd || '.'); | ||
@@ -33,3 +33,3 @@ var files, lastpath; | ||
// Search for files matching patterns. | ||
files = _.chain(patterns).map(function(pattern) { | ||
files = _(patterns).map(function(pattern) { | ||
return glob.sync(pattern, globOptions); | ||
@@ -36,0 +36,0 @@ }).flatten().uniq().value(); |
{ | ||
"name": "findup-sync", | ||
"description": "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/cowboy/node-findup-sync", | ||
@@ -31,11 +31,15 @@ "author": { | ||
"dependencies": { | ||
"glob": "~3.1.14", | ||
"lodash": "~0.9.1" | ||
"glob": "~3.1.21", | ||
"lodash": "~1.0.1" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.4.0a", | ||
"grunt-contrib-jshint": "~0.1.0", | ||
"grunt-contrib-nodeunit": "~0.1.0" | ||
"grunt": "~0.4.0", | ||
"grunt-contrib-jshint": "~0.2.0", | ||
"grunt-contrib-nodeunit": "~0.1.2" | ||
}, | ||
"keywords": [] | ||
"keywords": [ | ||
"find", | ||
"glob", | ||
"file" | ||
] | ||
} |
@@ -37,1 +37,9 @@ # findup-sync | ||
Note that if you want to start in a different directory than the current working directory, specify a `cwd` property here. | ||
## Contributing | ||
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). | ||
## Release History | ||
2013-03-08 - v0.1.2 - Updated dependencies. Fixed a Node 0.9.x bug. Updated unit tests to work cross-platform. | ||
2012-11-15 - v0.1.1 - Now works without an options object. | ||
2012-11-01 - v0.1.0 - Initial release. |
@@ -25,9 +25,9 @@ 'use strict'; | ||
var opts = {cwd: 'test/fixtures/a/b'}; | ||
test.equal(rel(findup('foo.txt', opts)), 'test/fixtures/a/foo.txt', 'should find files'); | ||
test.equal(rel(findup('bar.txt', opts)), 'test/fixtures/a/b/bar.txt', 'should find files'); | ||
test.equal(rel(findup('a.txt', opts)), 'test/fixtures/a.txt', 'should find files'); | ||
test.equal(rel(findup('?.txt', opts)), 'test/fixtures/a.txt', 'should support glob patterns'); | ||
test.equal(rel(findup('*.txt', opts)), 'test/fixtures/a/b/bar.txt', 'should find the first thing that matches the glob pattern'); | ||
test.equal(rel(findup(['b*.txt', 'f*.txt'], opts)), 'test/fixtures/a/b/bar.txt', 'should find the first thing that matches any of the glob patterns'); | ||
test.equal(rel(findup(['f*.txt', 'b*.txt'], opts)), 'test/fixtures/a/b/bar.txt', 'should find the first thing that matches any of the glob patterns'); | ||
test.equal(rel(findup('foo.txt', opts)), path.normalize('test/fixtures/a/foo.txt'), 'should find files'); | ||
test.equal(rel(findup('bar.txt', opts)), path.normalize('test/fixtures/a/b/bar.txt'), 'should find files'); | ||
test.equal(rel(findup('a.txt', opts)), path.normalize('test/fixtures/a.txt'), 'should find files'); | ||
test.equal(rel(findup('?.txt', opts)), path.normalize('test/fixtures/a.txt'), 'should support glob patterns'); | ||
test.equal(rel(findup('*.txt', opts)), path.normalize('test/fixtures/a/b/bar.txt'), 'should find the first thing that matches the glob pattern'); | ||
test.equal(rel(findup(['b*.txt', 'f*.txt'], opts)), path.normalize('test/fixtures/a/b/bar.txt'), 'should find the first thing that matches any of the glob patterns'); | ||
test.equal(rel(findup(['f*.txt', 'b*.txt'], opts)), path.normalize('test/fixtures/a/b/bar.txt'), 'should find the first thing that matches any of the glob patterns'); | ||
test.equal(findup('not-gonna-exist-i-hope.txt', opts), null, 'should returning null if no files found'); | ||
@@ -39,6 +39,6 @@ test.done(); | ||
process.chdir('test/fixtures/a/b'); | ||
test.equal(rel(findup('foo.txt')), '../foo.txt', 'should find files'); | ||
test.equal(rel(findup('foo.txt')), path.normalize('../foo.txt'), 'should find files'); | ||
test.equal(rel(findup('bar.txt')), 'bar.txt', 'should find files'); | ||
test.equal(rel(findup('a.txt')), '../../a.txt', 'should find files'); | ||
test.equal(rel(findup('?.txt')), '../../a.txt', 'should support glob patterns'); | ||
test.equal(rel(findup('a.txt')), path.normalize('../../a.txt'), 'should find files'); | ||
test.equal(rel(findup('?.txt')), path.normalize('../../a.txt'), 'should support glob patterns'); | ||
test.equal(rel(findup('*.txt')), 'bar.txt', 'should find the first thing that matches the glob pattern'); | ||
@@ -45,0 +45,0 @@ test.equal(rel(findup(['b*.txt', 'f*.txt'])), 'bar.txt', 'should find the first thing that matches any of the glob patterns'); |
Sorry, the diff of this file is not supported yet
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
7995
45
+ Addedlodash@1.0.2(transitive)
- Removedlodash@0.9.2(transitive)
Updatedglob@~3.1.21
Updatedlodash@~1.0.1