const bannedKeys = [ 'debug', 'where', 'select', 'insert', 'update', 'delete', 'count', 'sum', 'avg', 'max', 'min' ];

export function transformSomeToArray(source: any) {
  if (typeof source === 'string') 
    return source.split(','); 
  if (typeof source === 'object') {
    if (source instanceof Array)
      return source; 
    else {
      const arr = [];
      for (const key in source) {
        const sourceValue = source[key];
        if (bannedKeys.includes(key))
          continue;
        if (!sourceValue.id)
          continue;
        arr.push(sourceValue);
      }
      return arr;
    }
  }
  return source;
}