static/js/rule.js
/**
 * Generate a new name that does not conflict with existing names.
 * @function newName
 * @param {Set} exist - existing names
 * @param {string} prefix - name prefix
 * @returns {string} new name
 * @description Will read like "prefix_#", in which "#" is an incremental
 * integer.
 */
Generate a new name that does not conflict with existing names.
Generate a new name that does not conflict with existing names .
function newName(exist, prefix) {
  let name;
  let i = 1;
  while (true) {
    name = `${prefix}_${i}`;
    if (exist.has(name)) i ++;
    else return name;
  }
}
function newName ( exist , prefix ) { let name ; let i = 1 ; while ( true ) { name = ` ${ prefix } ${ i } ` ; if ( exist . has ( name ) ) i ++ ; else return name ; } }
Generate a new name that does not conflict with existing names.
Generate a new name that does not conflict with existing names .