msgArr.forEach(function(word){
   if (utils.type(word) !== 'string' || utils.type(word) !== 'number') {
     err = true;
   } else {
     cleanArr.push(word);
   }
 });
Exemple #2
0
 var redisCallback = function(err, result){
   var resultObj = null;
   var resultType = utils.type(result);
   if (resultType === 'array') {
     resultObj = {_id : intArgs[0]};
     fieldMaskArr.forEach(function(field, index){
       if (result[index]) resultObj[field] = result[index];
     })
   } else if (resultType === 'object') {
     resultObj = result;
     resultObj._id = intArgs[0];
   } else {
     //do nothing, it isnt an array or object
   }
   cb (err, resultObj);
 };
module.exports = function(msg, cb){
  if (!msg) return cb({errCode: '556bda45c6523900df226461', payload:msg});
  if (utils.type(msg) === 'array') return cleanArrayElements(msg, cb);
  if (utils.type(msg) === 'string') return convertToArray(msg, cb);
  return cb({errCode: '556bdf26c6523900df226463', payload:msg});
};