MCPcopy Create free account
hub / github.com/breck7/scroll / getUniqueAtomsArray

Method getUniqueAtomsArray

external/.scrollLibs.js:14404–14417  ·  view source on GitHub ↗
(allAtoms)

Source from the content-addressed store, hash-verified

14402 return text && text.replace ? text.replace(/<(?:.|\n)*?>/gm, "") : text
14403 }
14404 static getUniqueAtomsArray(allAtoms) {
14405 const atoms = allAtoms.replace(/\n/g, " ").split(" ")
14406 const index = {}
14407 atoms.forEach(atom => {
14408 if (!index[atom]) index[atom] = 0
14409 index[atom]++
14410 })
14411 return Object.keys(index).map(key => {
14412 return {
14413 atom: key,
14414 count: index[key]
14415 }
14416 })
14417 }
14418 static getRandomString(length = 30, letters = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""), seed = Date.now()) {
14419 let str = ""
14420 const randFn = Utils._getPseudoRandom0to1FloatGenerator(seed)

Callers

nothing calls this directly

Calls 4

splitMethod · 0.80
replaceMethod · 0.80
forEachMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected