@internal

Helper to create a unique name for a handle field based on the handle name, handle key and
source field.
325329
function getRelayHandleKey(
  handleName: string,
  key: ?string,
  fieldName: ?string,
): string {
  if (key && key !== DEFAULT_HANDLE_KEY) {
    return `__${key}_${handleName}`;
  }

  invariant(
    fieldName != null,
    'getRelayHandleKey: Expected either `fieldName` or `key` in `handle` to be provided',
  );
  return `__${fieldName}_${handleName}`;
}
1344062
def set_name(self, name):
        """"""
        if not name:
            name = ''
        self._client['config']['name'] = name
        yield from self._server.client_name(self.identifier, name)
491885
public function setName($name, $createHandle = false)
    {
        $this->_name = ($createHandle) ? Lang::createHandle($name) : $name;
    }
1328916
def _makeUniqueFilename(taken_names, name):
    
    if name in taken_names:
        # try to form up new name
        basename, ext = os.path.splitext(name)
        num = 1
        name = "%s-%d%s" % (basename, num, ext)
        while name in taken_names:
            num += 1
            name = "%s-%d%s" % (basename, num, ext)
    # finally, enter name into set
    taken_names.add(name)
    return name
1106224
def generate_unique_name(name_prefix, reservation_id=None):
    
    if reservation_id and isinstance(reservation_id, str) and len(reservation_id) >= 4:
        unique_id = str(uuid.uuid4())[:4] + "-" + reservation_id[-4:]
    else:
        unique_id = str(uuid.uuid4())[:8]
    return name_prefix + "_" + unique_id
1106002
function renameKey(fp, opts) {
  if (opts && opts.renameKey) {
    return opts.renameKey(fp, opts);
  }
  return basename(fp);
}
1224574
def generate_unique_name(self, basename):
        """"""
        counts = self.__counts
        try:
            count = counts[basename]
            counts[basename] += 1
        except KeyError:
            count = 0
            counts[basename] = 1
            
        prefix = self.Naming_prefix

        if count == 0:
            name = prefix + basename
        else:
            name = prefix + basename + "_" + str(count)
            
        if prefix != "" or count != 0:
            try:
                count = counts[name]
                return self.generate_unique_name(name)
            except KeyError:
                # wasn't already used so return it
                counts[name] = 1
        return name
1363818
public String createUniqueName(String name) {
		if (!isDuplicateName(name)) {
			return name;
		}
		if (name.matches(".*\\(\\d*\\)")) { //$NON-NLS-1$
			final int start = name.lastIndexOf('(');
			final int end = name.lastIndexOf(')');
			final String stringInt = name.substring(start + 1, end);
			final int numericValue = Integer.parseInt(stringInt);
			final String newName = name.substring(0, start + 1) + (numericValue + 1) + ")"; //$NON-NLS-1$
			return createUniqueName(newName);
		}
		return createUniqueName(name + " (1)"); //$NON-NLS-1$
	}
67254
def _buildNewKeyname(self,key,prepend):
        

        if len(prepend+key) <= 8: _new_key = prepend+key
        else: _new_key = str(prepend+key)[:8]

        return _new_key
1182203
function( name, handle ) {
		if ( munit.isObject( name ) ) {
			return munit.each( name, function( fn, method ) {
				munit.custom( method, fn );
			});
		}

		// Ensure that name can be used
		if ( munit.customReserved.indexOf( name ) > -1 ) {
			throw new Error( "'" + name + "' is a reserved name and cannot be added as a custom assertion test" );
		}

		// Send off to assertion module for attachment
		munit.Assert.prototype[ name ] = handle;
		munit.each( munit.ns, function( mod ) {
			mod.custom( name, handle );
		});
	}
1120001
def name(self, value):
        """"""
        self._name = value
        # generate slug
        if not self.slug:
            self.slug = KnwKB.generate_slug(value)
1089704
function addField(fields) {
  for (const fieldName in fields) {
    if (reservedFieldNames.indexOf(fieldName) >= 0) {
      throw new InvalidDefinitionError(this.name, 'field %s is reserved name', fieldName);
    }
    const field = Type.createField(this, fieldName, fields[fieldName]);
    if (field.props.unique && field.props.category === 'entity') {
      let unique = field.props.unique,
        message = `${fieldName} is unique`;
      if (typeof unique === 'string') message = unique;
      const index = {
        name: `${this.table}_${field.props.column}`,
        fields: [fieldName], unique: true, message,
      };
      this.indexes.push(index);
    }

    this.fields[fieldName] = field;
  }
}
411857
public function addUniqueKey($name, array $fields)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        $this->uniqueKeys[$name] = $fields;
        return $this;
    }
1146834
function serializeKey( name ) {
   const identifier = /^[A-Za-z$_][A-Za-z0-9$_]*$/.test( name );
   const keyword = [
      'if', 'else',
      'switch', 'case', 'default',
      'try', 'catch', 'finally',
      'function', 'return',
      'var', 'let', 'const'
   ].indexOf( name ) >= 0;

   return ( identifier && !keyword ) ? name : `"${name}"`;
}
1262492
function rename(key, newkey, req) {
  var val = this.getKey(key);
  this.delKey(key);
  this.setKey(newkey, val);
  return OK;
}
1169875
def names
      NAME_FIELDS.map { |k| has_field?(k) ? @fields[k].tokens : nil }.flatten.compact
    end
1346576
private String setterName(String fieldName) {
        return new StringBuilder(SET_PREFIX)
                .append(fieldName.substring(0, 1).toUpperCase(Locale.ENGLISH))
                .append(fieldName.substring(1))
                .toString();
    }