Get most matched Classes

const intersection = yourArray.filter(item1 => yourOtherArray.some(item2 => item2 === item1))
UU
Unknown User531d ago
M
Mana531d ago
You're doing == comparison on the entire array rather than its elements. Filtering array == arrayItem is never going to work right there.
UU
Unknown User531d ago
M
Mana531d ago
const icons = assignIcons
.filter(ai => ai.classList.some(i => elemClassList.includes(i)))
.map(ai => ({icons: ai, count: elemClassList.filter(i1 => ai.classList.some(i2 => i2 == i1)).length}))
.sort((a,b) => sortByTheNewCountHere);
const icons = assignIcons
.filter(ai => ai.classList.some(i => elemClassList.includes(i)))
.map(ai => ({icons: ai, count: elemClassList.filter(i1 => ai.classList.some(i2 => i2 == i1)).length}))
.sort((a,b) => sortByTheNewCountHere);
Something like that. It should then have the most matching item as the first item in the array.
UU
Unknown User530d ago
M
Mana530d ago
Add a tour.
UU
Unknown User530d ago
Want results from more Discord servers?
Add your server
More Posts
Application and EventsDoes anyone know if Foundry's `Application` (or the browser itself) does anything magical to clean uPopOut!Just starting a thread here for some discussion of "PopOut!" module in relation to my UI library / TPackage jam judge signup threadPackage jam judge signup thread (free league points inside)git filter troubleshootingI'm troubleshooting a new setup that my code contributors can benefit from. I'm using a .gitconfig fmultiroll damage roll messagesMessing with multiroll chat message in v10❓About Commissions**Do not post commissions in this thread.** This thread is for discussing the commissions process, gIssue Submission ToolI'm looking for suggestions for free ticket submission without signing into GitHub that go beyond BuMM+, manifest+, attributions, and moreWe can make a thread to keep the MM+ discussion seperate if you'd likeGlitterSuppose someone wanted to make a module which created a stylistic ~~defect~~ enhancement that never Here s an example No template data inHere's an example. No template data in the actor object, but the object is associated with a templatRolling Hooks**Rolling Hooks!** I am working on a couple of additions to one of the upcoming version of 5e to addWeight MRSure.2.0.0 explorationFrom Atropos in the mothership (in v10 Feedback) > Hello folks, for those of you testing V10 using tElectron ViteIt loads at least.early v10 compat testing@dnd5e - No action required Work is being done on fixing the core system compatibility with v10 in module.json helpYou have no manifest or download fields.TyphonJS Runtime Library - RC 0.0.12The TyphonJS Runtime Library / TRL release candidate version 0.0.12 is now available. This is a massCypress FunYeah, unfortunately it ain't that simple 😅 Cypress, like you say, automatically retries things, andpreUpdateHook questionHey all, question for anyone who has a sec. I'm trying to use `preCreateActor` to add rolled values spitballing about jest mocksok. ok. ok. pure spitballing theory here. All the client side source exists in esmodule form (hopef