0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

using minimatch instead of regexps

This commit is contained in:
Alex Kocharin 2013-06-14 13:27:08 +04:00
parent 4070eb7eb4
commit 26e3e21121
3 changed files with 4 additions and 8 deletions

View file

@ -1,5 +1,6 @@
var assert = require('assert');
var crypto = require('crypto');
var minimatch = require('minimatch');
// [[a, [b, c]], d] -> [a, b, c, d]
function flatten(array) {
@ -91,13 +92,7 @@ function Config(config) {
function allow_action(package, who, action) {
for (var i in this.packages) {
var match_package = i == package;
var m = i.match(/^\/(.*)\/$/);
if (m && (new RegExp(m[1])).exec(package)) {
match_package = true;
}
if (match_package) {
if (minimatch.makeRe(i).exec(package)) {
return this.packages[i][action].reduce(function(prev, curr) {
if (curr === who || curr === 'all') return true;
return prev;

View file

@ -11,7 +11,7 @@ uplinks:
url: https://registry.npmjs.org/
packages:
'/.*/':
'*':
publish: admin
access: all
proxy: npmjs

View file

@ -24,6 +24,7 @@ dependencies:
request: '*'
async: '*'
semver: '*'
minimatch: '*'
keywords: # TODO
- private