Comparing version 0.3.5 to 0.3.6
@@ -98,3 +98,3 @@ var minimatch = require('minimatch'); | ||
var callbacks = {}, negatedMap = {}, foundMap = {}; | ||
var callbacks = new Map(), negatedMap = new Map(), foundMap = new Map(); | ||
var globIdx, stemIdx, fileIdx = 0; | ||
@@ -132,21 +132,21 @@ | ||
// make sure the file isn't in the negation map and queue the callback | ||
if (typeof negatedMap[pattern.hash] !== 'undefined' | ||
&& negatedMap[pattern.hash][filename] === true) { | ||
if (typeof negatedMap.get(pattern.hash) !== 'undefined' | ||
&& negatedMap.get(pattern.hash)[filename] === true) { | ||
continue; | ||
} | ||
if (typeof foundMap[pattern.hash] === 'undefined') { | ||
foundMap[pattern.hash] = {}; | ||
if (typeof foundMap.get(pattern.hash) === 'undefined') { | ||
foundMap.set(pattern.hash, {}); | ||
} | ||
foundMap[pattern.hash][filename] = true; | ||
callbacks[pattern.hash] = pattern.data; | ||
foundMap.get(pattern.hash)[filename] = true; | ||
callbacks.set(pattern.hash, pattern.data); | ||
} else { | ||
// mark the hash as negated for this file | ||
if (typeof negatedMap[pattern.hash] === 'undefined') { | ||
negatedMap[pattern.hash] = {}; | ||
if (typeof negatedMap.get(pattern.hash) === 'undefined') { | ||
negatedMap.set(pattern.hash, {}); | ||
} | ||
negatedMap[pattern.hash][filename] = true; | ||
if (typeof foundMap[pattern.hash] !== 'undefined') { | ||
delete foundMap[pattern.hash][filename]; | ||
negatedMap.get(pattern.hash)[filename] = true; | ||
if (typeof foundMap.get(pattern.hash) !== 'undefined') { | ||
delete foundMap.get(pattern.hash)[filename]; | ||
} | ||
@@ -208,21 +208,21 @@ } | ||
// make sure the file isn't in the negation map and queue the callback | ||
if (typeof negatedMap[pattern.hash] !== 'undefined' | ||
&& negatedMap[pattern.hash][filename] === true) { | ||
if (typeof negatedMap.get(pattern.hash) !== 'undefined' | ||
&& negatedMap.get(pattern.hash)[filename] === true) { | ||
continue; | ||
} | ||
if (typeof foundMap[pattern.hash] === 'undefined') { | ||
foundMap[pattern.hash] = {}; | ||
if (typeof foundMap.get(pattern.hash) === 'undefined') { | ||
foundMap.set(pattern.hash, {}); | ||
} | ||
foundMap[pattern.hash][filename] = true; | ||
callbacks[pattern.hash] = pattern.data; | ||
foundMap.get(pattern.hash)[filename] = true; | ||
callbacks.set(pattern.hash, pattern.data); | ||
} else { | ||
// mark the hash as negated for this file | ||
if (typeof negatedMap[pattern.hash] === 'undefined') { | ||
negatedMap[pattern.hash] = {}; | ||
if (typeof negatedMap.get(pattern.hash) === 'undefined') { | ||
negatedMap.set(pattern.hash, {}); | ||
} | ||
negatedMap[pattern.hash][filename] = true; | ||
if (typeof foundMap[pattern.hash] !== 'undefined') { | ||
delete foundMap[pattern.hash][filename]; | ||
negatedMap.get(pattern.hash)[filename] = true; | ||
if (typeof foundMap.get(pattern.hash) !== 'undefined') { | ||
delete foundMap.get(pattern.hash)[filename]; | ||
} | ||
@@ -238,8 +238,8 @@ } | ||
var response = []; | ||
for (var key in foundMap) { | ||
var files = Object.keys(foundMap[key]); | ||
foundMap.forEach(function (val, key) { | ||
var files = Object.keys(val); | ||
if (files.length !== 0) { | ||
response.push({data: callbacks[key], files: files}); | ||
response.push({data: callbacks.get(key), files: files}); | ||
} | ||
} | ||
}); | ||
return response; | ||
@@ -246,0 +246,0 @@ }; |
{ | ||
"name": "minimagic", | ||
"description": "fast minimatching", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"homepage": "https://github.com/azulus/minimagic", | ||
@@ -6,0 +6,0 @@ "authors": [ |
10283