vicinityManager/server/services/items/registration.js
/*
Extract valuable info from the types request static service
*/
Extract valuable info from the types request static service
Extract valuable info from the types request static service
function parseGetTypes(arr){
  return new Promise(function(resolve, reject) {
    try{
      var myTypes = []; 
      var pos = 0; 
      var aux = ""; 
      for(var i=0; i<arr.length; i++){
        aux = arr[i].s.value;
        pos = aux.indexOf('#',0);
        myTypes.push(aux.substr(pos+1));
      }
      resolve(myTypes);
    }
    catch(err)
    {
      reject("(Error parsing types) " + err);
    }
  });
}
function parseGetTypes ( arr ) { return new Promise ( function ( resolve , reject ) { try { var myTypes = [ ] ; var pos = 0 ; var aux = "" ; for ( var i = 0 ; i < arr . length ; i ++ ) { aux = arr [ i ] . s . value ; pos = aux . indexOf ( '#' , 0 ) ; myTypes . push ( aux . substr ( pos + 1 ) ) ; } resolve ( myTypes ) ; } catch ( err ) { reject ( "(Error parsing types) " + err ) ; } } ) ; }
Extract valuable info from the types request static service
Extract valuable info from the types request static service
// store types // keeps position in the string where the actual type starts // keeps the value for each iteration