MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / sameCharFrequency

Function sameCharFrequency

frontend/lib/utils.ts:252–266  ·  view source on GitHub ↗

* Compare two strings by character frequency (order-agnostic)

(a: string, b: string)

Source from the content-addressed store, hash-verified

250 * Compare two strings by character frequency (order-agnostic)
251 */
252function sameCharFrequency(a: string, b: string): boolean {
253 const trimmedA = a.trim()
254 const trimmedB = b.trim()
255 if (trimmedA.length !== trimmedB.length) return false
256
257 const dictA = charCountDict(trimmedA)
258 const dictB = charCountDict(trimmedB)
259
260 if (dictA.size !== dictB.size) return false
261
262 for (const [char, count] of dictA) {
263 if (dictB.get(char) !== count) return false
264 }
265 return true
266}
267
268/**
269 * Replace specific parts of XML content using search and replace pairs

Callers 1

replaceXMLPartsFunction · 0.85

Calls 1

charCountDictFunction · 0.85

Tested by

no test coverage detected