Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-glob

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-glob - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

61

index.js
/*!
* parse-glob <https://github.com/jonschlinkert/parse-glob>
*
* Copyright (c) 2015 Jon Schlinkert.
* Licensed under the MIT license.
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/

@@ -10,2 +10,3 @@

var findBase = require('glob-base');
var pathRe = require('glob-path-regex');

@@ -36,4 +37,4 @@ var isGlob = require('is-glob');

var glob = pattern;
var tok = {path: {}, is: {}, match: {}};
var path = {};
var tok = {path: {}, is: {}, match: {}};

@@ -46,5 +47,5 @@ // store original pattern

// Boolean values
tok.is.glob = isGlob(glob);
tok.is.negated = glob.charAt(0) === '!';
tok.is.globstar = glob.indexOf('**') !== -1;
tok.is.glob = isGlob(glob);
tok.is.negated = glob.charAt(0) === '!';
tok.is.globstar = glob.indexOf('**') !== -1;

@@ -99,3 +100,2 @@ var braces = glob.indexOf('{') !== -1;

path.ext = path.extname.split('.').slice(-1)[0];
// remove any escaping that was applied for braces

@@ -113,3 +113,3 @@ if (braces) {

if (getbase) {
var segs = findBase(tok);
var segs = findBase(tok.pattern);
tok.pattern = segs.pattern;

@@ -168,40 +168,2 @@ tok.base = segs.base;

/**
* Extract the `base` path from a glob
* pattern.
*
* @param {Object} `tok` The tokens object
* @return {Object}
*/
function findBase(tok) {
var glob = tok.pattern;
var res = {base: '', pattern: glob};
var segs = glob.split('/');
var len = segs.length, i = 0;
var base = [];
while (len--) {
var seg = segs[i++];
if (!seg || isGlob(seg)) {
break;
}
base.push(seg);
}
if (i === 0) { return null; }
var num = (segs.length - base.length);
var end = base.join('/');
if (end.indexOf('./') === 0) {
end = end.slice(2);
}
res.base = end;
res.pattern = segs.slice(-num).join('/');
return res;
}
/**
* Cache the glob string to avoid parsing the same

@@ -249,8 +211,1 @@ * pattern more than once.

}
function trim(str, ch) {
if (str.slice(-ch.length)[0] === ch) {
return str.slice(0, str.length - ch.length);
}
return str;
}

7

package.json
{
"name": "parse-glob",
"description": "Parse a glob pattern into an object of tokens.",
"version": "2.0.1",
"version": "2.1.0",
"homepage": "https://github.com/jonschlinkert/parse-glob",

@@ -32,2 +32,3 @@ "author": {

"dependencies": {
"glob-base": "^0.1.0",
"glob-path-regex": "^1.0.0",

@@ -37,5 +38,5 @@ "is-glob": "^1.1.0"

"devDependencies": {
"lodash": "^3.3.1",
"mocha": "*"
},
"keywords": []
}
}

@@ -1,2 +0,2 @@

# parse-glob [![NPM version](https://badge.fury.io/js/parse-glob.svg)](http://badge.fury.io/js/parse-glob)
# parse-glob [![NPM version](https://badge.fury.io/js/parse-glob.svg)](http://badge.fury.io/js/parse-glob) [![Build Status](https://travis-ci.org/jonschlinkert/parse-glob.svg)](https://travis-ci.org/jonschlinkert/parse-glob)

@@ -105,7 +105,16 @@ > Parse a glob pattern into an object of tokens.

## Related
* [glob-base](https://github.com/jonschlinkert/glob-base): Split a glob into a base path and a pattern.
* [glob-parent](https://github.com/es128/glob-parent): Strips glob magic from a string to provide the parent path
* [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern.
* [glob-path-regex](https://github.com/regexps/glob-path-regex): Regular expression for matching the parts of glob pattern.
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A faster alternative to minimatch (10-45x faster on avg), with all the features you're used to using in your Grunt and gulp tasks.
## Run tests
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-glob/issues)
Install dev dependencies:
## Tests
Install dev dependencies.
```bash

@@ -115,4 +124,2 @@ npm i -d && npm test

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-glob/issues)

@@ -127,3 +134,3 @@ ## Author

## License
Copyright (c) 2015 Jon Schlinkert
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license

@@ -133,2 +140,2 @@

_This file was generated by [verb](https://github.com/assemble/verb) on February 17, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 04, 2015._

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc