MCPcopy Create free account
hub / github.com/webpack/mini-css-extract-plugin / getCommonSuffix

Function getCommonSuffix

src/utils.js:259–277  ·  view source on GitHub ↗
(items)

Source from the content-addressed store, hash-verified

257 * @returns {string} common suffix
258 */
259const getCommonSuffix = (items) => {
260 let [suffix] = items;
261
262 for (let i = 1; i < items.length; i++) {
263 const item = items[i];
264 for (
265 let itemIndex = item.length - 1, suffixIndex = suffix.length - 1;
266 suffixIndex >= 0;
267 itemIndex--, suffixIndex--
268 ) {
269 if (item[itemIndex] !== suffix[suffixIndex]) {
270 suffix = suffix.slice(suffixIndex + 1);
271 break;
272 }
273 }
274 }
275
276 return suffix;
277};
278
279/**
280 * @param {Set<string>} itemsSet items set

Callers 1

itemsToRegexpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…