MCPcopy Index your code
hub / github.com/nodejs/node / add

Method add

lib/internal/fs/glob.js:233–242  ·  view source on GitHub ↗
(path, pattern)

Source from the content-addressed store, hash-verified

231 return val;
232 }
233 add(path, pattern) {
234 let cache = this.#cache.get(path);
235 if (!cache) {
236 cache = new SafeSet();
237 this.#cache.set(path, cache);
238 }
239 const originalSize = cache.size;
240 pattern.indexes.forEach((index) => cache.add(pattern.cacheKey(index)));
241 return cache.size !== originalSize + pattern.indexes.size;
242 }
243 seen(path, pattern, index) {
244 return this.#cache.get(path)?.has(pattern.cacheKey(index));
245 }

Callers

nothing calls this directly

Calls 5

cacheKeyMethod · 0.80
getMethod · 0.65
forEachMethod · 0.65
addMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected