lib/mock/edit-collection.js
function getResourceNameByRequired (data, schema) {
  let propInfo = {
    name: "",
    schema: {
      type: ""
    },
    value: undefined
  };

  let foundMatch = _.some(schema.required, (propName) => {
    propInfo.name = propName;
    propInfo.schema = schema.properties[propName];
    propInfo.value = data[propName];

    // If the property is valid, then we're done
    return isValidResourceName(propInfo);
  });

  return foundMatch ? propInfo : undefined;
}
function getResourceNameByRequired (data, schema) {
  let propInfo = {
    name: "",
    schema: {
      type: ""
    },
    value: undefined
  };

  let foundMatch = _.some(schema.required, (propName) => {
    propInfo.name = propName;
    propInfo.schema = schema.properties[propName];
    propInfo.value = data[propName];

    // If the property is valid, then we're done
    return isValidResourceName(propInfo);
  });

  return foundMatch ? propInfo : undefined;
}
function getResourceNameByRequired ( data , schema ) { let propInfo = { name : "" , schema : { type : "" } , value : undefined } ; let foundMatch = _ . some ( schema . required , ( propName ) => { propInfo . name = propName ; propInfo . schema = schema . properties [ propName ] ; propInfo . value = data [ propName ] ; // If the property is valid, then we're done return isValidResourceName ( propInfo ) ; } ) ; return foundMatch ? propInfo : undefined ; }
Tries to find the REST resource's name using the required properties in the JSON schema.
We're assuming that if the resource has a name, it'll be a required property.

@param   {*}         data   - The parsed resource data.
@param   {object}    schema - The JSON schema for the data.
@returns {PropertyInfo|undefined}
Tries to find the REST resource s name using the required properties in the JSON schema . We re assuming that if the resource has a name it ll be a required property .