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

Function getCommonPrefix

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

Source from the content-addressed store, hash-verified

237 * @returns {string} common prefix
238 */
239const getCommonPrefix = (items) => {
240 let [prefix] = items;
241
242 for (let i = 1; i < items.length; i++) {
243 const item = items[i];
244 for (let prefixIndex = 0; prefixIndex < prefix.length; prefixIndex++) {
245 if (item[prefixIndex] !== prefix[prefixIndex]) {
246 prefix = prefix.slice(0, prefixIndex);
247 break;
248 }
249 }
250 }
251
252 return prefix;
253};
254
255/**
256 * @param {string[]} items items

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…