Comparing version 0.2.0 to 0.2.1
@@ -28,2 +28,10 @@ # {%= name %} {%= badge("fury") %} | ||
### options.cwd | ||
Define the current working directory | ||
```js | ||
files('*.txt', {cwd: 'templates'}); | ||
``` | ||
### options.name | ||
@@ -30,0 +38,0 @@ |
@@ -9,2 +9,3 @@ 'use strict'; | ||
var path = require('path'); | ||
var relative = require('relative'); | ||
var glob = require('globby'); | ||
@@ -24,4 +25,6 @@ | ||
var files = glob.sync(patterns, options); | ||
var cwd = options && options.cwd || process.cwd(); | ||
return files.reduce(function (cache, filepath) { | ||
filepath = relative(path.resolve(cwd, filepath)); | ||
var key = name(filepath, options); | ||
@@ -28,0 +31,0 @@ var str = read(filepath, options); |
{ | ||
"name": "map-files", | ||
"description": "Return an object for a glob of files. Pass a `rename` function for the keys, or a `parse` function for the content, allowing it to be used for readable or require-able files.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/jonschlinkert/map-files", | ||
@@ -31,3 +31,4 @@ "author": { | ||
"dependencies": { | ||
"globby": "^0.1.1" | ||
"globby": "^0.1.1", | ||
"relative": "^0.1.6" | ||
}, | ||
@@ -39,3 +40,3 @@ "devDependencies": { | ||
"verb": ">= 0.2.6", | ||
"verb-tag-jscomments": ">= 0.2.0" | ||
"verb-tag-jscomments": "^0.2.2" | ||
}, | ||
@@ -42,0 +43,0 @@ "keywords": [ |
@@ -33,2 +33,10 @@ # map-files [![NPM version](https://badge.fury.io/js/map-files.svg)](http://badge.fury.io/js/map-files) | ||
### options.cwd | ||
Define the current working directory | ||
```js | ||
files('*.txt', {cwd: 'templates'}); | ||
``` | ||
### options.name | ||
@@ -85,4 +93,4 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 10, 2014._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 16, 2014._ | ||
[globby]: https://github.com/sindresorhus/globby |
@@ -33,2 +33,15 @@ /*! | ||
it('should use a cwd.', function () { | ||
var cache = files('*.txt', {cwd: 'test/fixtures'}); | ||
cache.should.have.property('a'); | ||
cache.should.have.property('b'); | ||
cache.should.have.property('c'); | ||
cache.should.eql({ | ||
a: { content: 'AAA', path: 'test/fixtures/a.txt' }, | ||
b: { content: 'BBB', path: 'test/fixtures/b.txt' }, | ||
c: { content: 'CCC', path: 'test/fixtures/c.txt' } | ||
}); | ||
}); | ||
it('should rename the key with a custom function.', function () { | ||
@@ -35,0 +48,0 @@ var cache = files('test/fixtures/*.txt', { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12016
142
94
0
2
+ Addedrelative@^0.1.6
+ Addednormalize-path@0.1.1(transitive)
+ Addedrelative@0.1.6(transitive)