You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
rdrew 1440706ce3 fixed gulp 6 years ago
..
node_modules/extend-shallow fixed gulp 6 years ago
LICENSE fixed gulp 6 years ago
index.js fixed gulp 6 years ago
package.json fixed gulp 6 years ago
readme.md fixed gulp 6 years ago

readme.md

to-absolute-glob NPM version

Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.

Install

Install with npm

$ npm i to-absolute-glob --save

Usage

var toAbsGlob = require('to-absolute-glob');
toAbsGlob('a/*.js');
//=> '/dev/foo/a/*.js'

Examples

Given the current project folder (cwd) is /dev/foo/:

makes a path absolute

toAbsGlob('a');
//=> '/dev/foo/a'

makes a glob absolute

toAbsGlob('a/*.js');
//=> '/dev/foo/a/*.js'

retains trailing slashes

toAbsGlob('a/*/');
//=> '/dev/foo/a/*/'

retains trailing slashes with cwd

toAbsGlob('./fixtures/whatsgoingon/*/', {cwd: __dirname});
//=> '/dev/foo/'

makes a negative glob absolute

toAbsGlob('!a/*.js');
//=> '!/dev/foo/a/*.js'

from a cwd

toAbsGlob('a/*.js', {cwd: 'foo'});
//=> '/dev/foo/foo/a/*.js'

makes a negative glob absolute from a cwd

toAbsGlob('!a/*.js', {cwd: 'foo'});
//=> '!/dev/foo/foo/a/*.js'

from a root path

toAbsGlob('/a/*.js', {root: 'baz'});
//=> '/dev/foo/baz/a/*.js'

from a root slash

toAbsGlob('/a/*.js', {root: '/'});
//=> '/dev/foo/a/*.js'

from a negative root path

toAbsGlob('!/a/*.js', {root: 'baz'});
//=> '!/dev/foo/baz/a/*.js'

from a negative root slash

toAbsGlob('!/a/*.js', {root: '/'});
//=> '!/dev/foo/a/*.js'

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on November 05, 2015.