lib/mock/edit-collection.js
function getResourceName (data, schema) {
  // Try to find the "name" property using several different methods
  let propInfo =
        getResourceNameByValue(data, schema) ||
        getResourceNameByName(data, schema) ||
        getResourceNameByRequired(data, schema) ||
        getResourceNameByFile(data, schema);

  if (propInfo) {
    util.debug('The "%s" property (%j) appears to be the REST resource\'s name', propInfo.name, propInfo.value);

    if (propInfo.value === undefined) {
      propInfo.value = new JsonSchema(propInfo.schema).sample();
      util.debug('Generated new value (%j) for the "%s" property', propInfo.value, propInfo.name);
    }

    return propInfo;
  }
  else {
    util.debug("Unable to determine the unique name for the REST resource. Generating a unique value instead");
    return {
      name: "",
      schema: { type: "string" },
      value: _.uniqueId()
    };
  }
}
function getResourceName (data, schema) {
  // Try to find the "name" property using several different methods
  let propInfo =
        getResourceNameByValue(data, schema) ||
        getResourceNameByName(data, schema) ||
        getResourceNameByRequired(data, schema) ||
        getResourceNameByFile(data, schema);

  if (propInfo) {
    util.debug('The "%s" property (%j) appears to be the REST resource\'s name', propInfo.name, propInfo.value);

    if (propInfo.value === undefined) {
      propInfo.value = new JsonSchema(propInfo.schema).sample();
      util.debug('Generated new value (%j) for the "%s" property', propInfo.value, propInfo.name);
    }

    return propInfo;
  }
  else {
    util.debug("Unable to determine the unique name for the REST resource. Generating a unique value instead");
    return {
      name: "",
      schema: { type: "string" },
      value: _.uniqueId()
    };
  }
}
function getResourceName ( data , schema ) { // Try to find the "name" property using several different methods let propInfo = getResourceNameByValue ( data , schema ) || getResourceNameByName ( data , schema ) || getResourceNameByRequired ( data , schema ) || getResourceNameByFile ( data , schema ) ; if ( propInfo ) { util . debug ( 'The "%s" property (%j) appears to be the REST resource\'s name' , propInfo . name , propInfo . value ) ; if ( propInfo . value === undefined ) { propInfo . value = new JsonSchema ( propInfo . schema ) . sample ( ) ; util . debug ( 'Generated new value (%j) for the "%s" property' , propInfo . value , propInfo . name ) ; } return propInfo ; } else { util . debug ( "Unable to determine the unique name for the REST resource. Generating a unique value instead" ) ; return { name : "" , schema : { type : "string" } , value : _ . uniqueId ( ) } ; } }
Returns the property that is the REST resource's "unique" name.

@param   {*}         data   - The parsed resource data.
@param   {object}    schema - The JSON schema for the data.
@returns {PropertyInfo}     - The resource's name.
Returns the property that is the REST resource s unique name .