MCPcopy Create free account
hub / github.com/decaporg/decap-cms / collectionKeyForFiles

Function collectionKeyForFiles

packages/decap-cms-lib-util/src/backendUtil.ts:131–138  ·  view source on GitHub ↗
(paths: string[])

Source from the content-addressed store, hash-verified

129 * rows; FNV-1a, because it must be deterministic, short and synchronous.
130 */
131export function collectionKeyForFiles(paths: string[]) {
132 let hash = 0x811c9dc5;
133 for (const char of [...paths].sort().join('\n')) {
134 hash ^= char.charCodeAt(0);
135 hash = Math.imul(hash, 0x01000193) >>> 0;
136 }
137 return `files:${paths.length}:${hash.toString(36)}`;
138}

Callers 2

entriesByFilesMethod · 0.90

Calls 2

sortMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected