Script call needed to test class traits

I need a script call that can determine if a certain class has access to a skill. The skill is granted in the "traits" section of the editor. I suspect it'll be something like $dataClasses.traits.somethingsomething. (I believe the trait code for skills is 43.) Just not sure exactly which function to use to check if a class has trait code 43 and id x.

(Note: I need to directly check the class itself, not a specific actor.)

For context, I've modified Yanfly's Region Restrict script to work with terrain tags, which allows swimming for certain classes that I've given the Swim skill. I've also modified Yanfly's Class Change Core to populate the class list with classes that are valid for the current terrain tag (ie. no changing to a non-swimming class while on a water tile). Currently, I use a manual list of the swimmer class id's to regulate what gets added to the class list, but this is a workaround and I'd rather find a way to automatically check for the Swim skill as the list is being populated.

Thanks in advance!
If you want to test if a particular class has a particular skill added in its "Traits" section in the database, the call is:
$dataClasses[x].traits.some(function(trait){return trait.code == 43 && trait.dataId == y});
Where x is the Class ID and y is the Skill ID.

If, however, you want to test if a particular class has a particular skill listed in its "Skills to Learn" section in the database, the call is:
$dataClasses[x].learnings.some(function(learnskill){return learnskill.skillId == y});
Where x is the Class ID and y is the Skill ID. This doesn't take into account whether the actor is the level required for the skill.

If what you need is different than either of these, let me know and we'll try to tweak it for your specific needs.
AWESOME! Thank you! This will save me a ton of manual backend management.

Just tested: it works flawlessly. Thanks again.

Original thread: https://forums.rpgmakerweb.com/threads/script-call-needed-to-test-class-traits.86641/