src/utils/miscUtilities.js
// - does the defnObj have a superclass
does the defnObj have a superclass
does the defnObj have a superclass
function checkSuperClassObjConflict(
  JSONFile,
  defnName,
  superClassOrObjectNameToAdd
) {
  let defnTopLevelConflicts = getAllSuperClassesInDefn(JSONFile, defnName);
  for (let i in defnTopLevelConflicts) {
    defnTopLevelConflicts = defnTopLevelConflicts.concat(
      getTopLevelObjects(JSONFile, defnTopLevelConflicts[i])
    );
  }
  defnTopLevelConflicts = defnTopLevelConflicts.concat(
    getTopLevelObjects(JSONFile, defnName)
  );
  defnTopLevelConflicts = [...new Set(defnTopLevelConflicts)];
  let addingSuperClassOrObjectName = [superClassOrObjectNameToAdd];
  addingSuperClassOrObjectName = addingSuperClassOrObjectName.concat(
    getAllSuperClassesInDefn(JSONFile, superClassOrObjectNameToAdd)
  );
  for (let i in addingSuperClassOrObjectName) {
    addingSuperClassOrObjectName = addingSuperClassOrObjectName.concat(
      getTopLevelObjects(JSONFile, addingSuperClassOrObjectName[i])
    );
  }
  addingSuperClassOrObjectName = addingSuperClassOrObjectName.concat(
    getTopLevelObjects(JSONFile, superClassOrObjectNameToAdd)
  );
  addingSuperClassOrObjectName = [...new Set(addingSuperClassOrObjectName)];
  let hasConflict = false;
  for (let i in defnTopLevelConflicts) {
    for (let j in addingSuperClassOrObjectName) {
      if (defnTopLevelConflicts[i] == addingSuperClassOrObjectName[j]) {
        hasConflict = true;
      }
    }
  }
  return hasConflict;
}
function checkSuperClassObjConflict ( JSONFile , defnName , superClassOrObjectNameToAdd ) { let defnTopLevelConflicts = getAllSuperClassesInDefn ( JSONFile , defnName ) ; for ( let i in defnTopLevelConflicts ) { defnTopLevelConflicts = defnTopLevelConflicts . concat ( getTopLevelObjects ( JSONFile , defnTopLevelConflicts [ i ] ) ) ; } defnTopLevelConflicts = defnTopLevelConflicts . concat ( getTopLevelObjects ( JSONFile , defnName ) ) ; defnTopLevelConflicts = [ ... new Set ( defnTopLevelConflicts ) ] ; let addingSuperClassOrObjectName = [ superClassOrObjectNameToAdd ] ; addingSuperClassOrObjectName = addingSuperClassOrObjectName . concat ( getAllSuperClassesInDefn ( JSONFile , superClassOrObjectNameToAdd ) ) ; for ( let i in addingSuperClassOrObjectName ) { addingSuperClassOrObjectName = addingSuperClassOrObjectName . concat ( getTopLevelObjects ( JSONFile , addingSuperClassOrObjectName [ i ] ) ) ; } addingSuperClassOrObjectName = addingSuperClassOrObjectName . concat ( getTopLevelObjects ( JSONFile , superClassOrObjectNameToAdd ) ) ; addingSuperClassOrObjectName = [ ... new Set ( addingSuperClassOrObjectName ) ] ; let hasConflict = false ; for ( let i in defnTopLevelConflicts ) { for ( let j in addingSuperClassOrObjectName ) { if ( defnTopLevelConflicts [ i ] == addingSuperClassOrObjectName [ j ] ) { hasConflict = true ; } } } return hasConflict ; }
does the defnObj have a superclass
does the defnObj have a superclass