pax_global_header00006660000000000000000000000064130014725330014510gustar00rootroot0000000000000052 comment=780981098bc70fac40b7c1f6aba6dc6c3b0f768b glob-parent-3.0.1/000077500000000000000000000000001300147253300137235ustar00rootroot00000000000000glob-parent-3.0.1/.gitignore000066400000000000000000000000561300147253300157140ustar00rootroot00000000000000node_modules .DS_Store npm-debug.log coverage glob-parent-3.0.1/.travis.yml000066400000000000000000000001321300147253300160300ustar00rootroot00000000000000language: node_js node_js: - "6" - "5" - "4" - "0.10" script: - npm run ci-test glob-parent-3.0.1/LICENSE000066400000000000000000000013531300147253300147320ustar00rootroot00000000000000The ISC License Copyright (c) 2015 Elan Shanker Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. glob-parent-3.0.1/README.md000066400000000000000000000027561300147253300152140ustar00rootroot00000000000000glob-parent [![Build Status](https://travis-ci.org/es128/glob-parent.svg)](https://travis-ci.org/es128/glob-parent) [![Coverage Status](https://img.shields.io/coveralls/es128/glob-parent.svg)](https://coveralls.io/r/es128/glob-parent?branch=master) ====== Javascript module to extract the non-magic parent path from a glob string. [![NPM](https://nodei.co/npm/glob-parent.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/glob-parent/) [![NPM](https://nodei.co/npm-dl/glob-parent.png?height=3&months=9)](https://nodei.co/npm-dl/glob-parent/) Usage ----- ```sh npm install glob-parent --save ``` ```js var globParent = require('glob-parent'); globParent('path/to/*.js'); // 'path/to' globParent('/root/path/to/*.js'); // '/root/path/to' globParent('/*.js'); // '/' globParent('*.js'); // '.' globParent('**/*.js'); // '.' globParent('path/{to,from}'); // 'path' globParent('path/!(to|from)'); // 'path' globParent('path/?(to|from)'); // 'path' globParent('path/+(to|from)'); // 'path' globParent('path/*(to|from)'); // 'path' globParent('path/@(to|from)'); // 'path' globParent('path/**/*'); // 'path' // if provided a non-glob path, returns the nearest dir globParent('path/foo/bar.js'); // 'path/foo' globParent('path/foo/'); // 'path/foo' globParent('path/foo'); // 'path' (see issue #3 for details) ``` Change Log ---------- [See release notes page on GitHub](https://github.com/es128/glob-parent/releases) License ------- [ISC](https://raw.github.com/es128/glob-parent/master/LICENSE) glob-parent-3.0.1/appveyor.yml000066400000000000000000000010041300147253300163060ustar00rootroot00000000000000 # Test against this version of Node.js environment: matrix: - nodejs_version: "6" - nodejs_version: "5" - nodejs_version: "4" # Install scripts. (runs after repo cloning) install: # Get the latest stable version of Node.js or io.js - ps: Install-Product node $env:nodejs_version # install modules - npm install # Post-install test scripts. test_script: # Output useful info for debugging. - node --version - npm --version # run tests - npm test # Don't actually build. build: off glob-parent-3.0.1/index.js000066400000000000000000000004031300147253300153650ustar00rootroot00000000000000'use strict'; var path = require('path'); var isglob = require('is-glob'); module.exports = function globParent(str) { str += 'a'; // preserves full path in case of trailing path separator do {str = path.dirname(str)} while (isglob(str)); return str; }; glob-parent-3.0.1/package.json000066400000000000000000000014761300147253300162210ustar00rootroot00000000000000{ "name": "glob-parent", "version": "3.0.1", "description": "Strips glob magic from a string to provide the parent path", "main": "index.js", "scripts": { "test": "istanbul test node_modules/mocha/bin/_mocha", "ci-test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls" }, "repository": { "type": "git", "url": "https://github.com/es128/glob-parent" }, "keywords": [ "glob", "parent", "strip", "path", "directory", "base" ], "author": "Elan Shanker", "license": "ISC", "bugs": { "url": "https://github.com/es128/glob-parent/issues" }, "homepage": "https://github.com/es128/glob-parent", "dependencies": { "is-glob": "^3.0.0" }, "devDependencies": { "coveralls": "^2.11.2", "istanbul": "^0.3.5", "mocha": "^2.1.0" } } glob-parent-3.0.1/test.js000066400000000000000000000047531300147253300152510ustar00rootroot00000000000000'use strict'; var gp = require('./'); var assert = require('assert'); describe('glob-parent', function() { it('should strip glob magic to return parent path', function() { assert.equal(gp('path/to/*.js'), 'path/to'); assert.equal(gp('/root/path/to/*.js'), '/root/path/to'); assert.equal(gp('/*.js'), '/'); assert.equal(gp('*.js'), '.'); assert.equal(gp('**/*.js'), '.'); assert.equal(gp('path/[a-z]'), 'path'); assert.equal(gp('path/{to,from}'), 'path'); assert.equal(gp('path/(to|from)'), 'path'); assert.equal(gp('path/!(to|from)'), 'path'); assert.equal(gp('path/?(to|from)'), 'path'); assert.equal(gp('path/+(to|from)'), 'path'); assert.equal(gp('path/*(to|from)'), 'path'); assert.equal(gp('path/@(to|from)'), 'path'); assert.equal(gp('path/**/*'), 'path'); assert.equal(gp('path/**/subdir/foo.*'), 'path'); }); it('should return parent dirname from non-glob paths', function() { assert.equal(gp('path/foo/bar.js'), 'path/foo'); assert.equal(gp('path/foo/'), 'path/foo'); assert.equal(gp('path/foo'), 'path'); }); }); describe('glob2base test patterns', function() { it('should get a base name', function() { assert.equal(gp('js/*.js') + '/', 'js/'); }); it('should get a base name from a nested glob', function() { assert.equal(gp('js/**/test/*.js') + '/', 'js/'); }); it('should get a base name from a flat file', function() { assert.equal(gp('js/test/wow.js') + '/', 'js/test/'); }); it('should get a base name from character class pattern', function() { assert.equal(gp('js/t[a-z]st}/*.js') + '/', 'js/'); }); it('should get a base name from brace , expansion', function() { assert.equal(gp('js/{src,test}/*.js') + '/', 'js/'); }); it('should get a base name from brace .. expansion', function() { assert.equal(gp('js/test{0..9}/*.js') + '/', 'js/'); }); it('should get a base name from extglob', function() { assert.equal(gp('js/t+(wo|est)/*.js') + '/', 'js/'); }); it('should get a base name from a path with non-exglob parens', function() { assert.equal(gp('js/t(wo|est)/*.js'), 'js'); assert.equal(gp('js/t/(wo|est)/*.js'), 'js/t'); }); it('should get a base name from a complex brace glob', function() { assert.equal(gp('lib/{components,pages}/**/{test,another}/*.txt') + '/', 'lib/'); assert.equal(gp('js/test/**/{images,components}/*.js') + '/', 'js/test/'); assert.equal(gp('ooga/{booga,sooga}/**/dooga/{eooga,fooga}') + '/', 'ooga/'); }); });