Socket
Socket
Sign inDemoInstall

glob-regex

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glob-regex - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

4

index.js

@@ -15,4 +15,4 @@

.replace(globDirsRE, '(.+/)?')
.replace(globAllRE, '(.+/)?*')
.replace(globNamesRE, '[^/]+')
.replace(globAllRE, '(.+/)?([^/]+\/?)')
.replace(globNamesRE, '([^/]+)')

@@ -19,0 +19,0 @@ return new RegExp('^' + pattern + '$')

{
"name": "glob-regex",
"version": "0.1.1",
"version": "0.2.0",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

# glob-regex v0.1.1
# glob-regex v0.2.0

@@ -4,0 +4,0 @@ Convert a glob to a `RegExp` object.

#!/usr/bin/env node
// @flow
const {test} = require('testpass')
const {test, group} = require('testpass')

@@ -88,1 +88,33 @@ const globRegex = require('.')

})
// [0] the input
group('capture groups:', () => {
// [1] the filename
test('*.js', (t) => {
const re = globRegex('*.js')
cap(t, re, 'a.js', 'a')
})
// [1] the directory (or null)
// [2] the filename
test('**.js', (t) => {
const re = globRegex('**.js')
cap(t, re, 'a.js', undefined, 'a')
cap(t, re, 'a/b.js', 'a/', 'b')
})
// [1] the parent of __tests__
// [2] the filename
test('**/__tests__/*.js', (t) => {
const re = globRegex('**/__tests__/*.js')
cap(t, re, '__tests__/a.js', undefined, 'a')
cap(t, re, 'a/b/__tests__/c.js', 'a/b/', 'c')
})
function cap(t, re, input, /*:: ...expected: string[] */) {
const expected = [].slice.call(arguments, 2)
re.lastIndex = 0
t.eq(re.exec(input), expected)
}
})
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