src/lib/session.js
// list all sessions of a given type
list all sessions of a given type
list all sessions of a given type
list({ type, sort, filter, limit }) {
    let sessions, index;
    if (sort === 'count' || sort === 'per_hour') {
      index = this.indexes.getIn([type, '24h'], Map());
    } else if (sort === 'speed' || sort === 'per_minute') {
      index = this.indexes.getIn([type, '15m'], Map());
    }
    index = index.sort().reverse();
    sessions = index
      .keySeq()
      .map(key => this.get(type, key))
      .filter(s => s !== undefined);
    if (filter) {
      sessions = sessions.filter(filter);
    }
    if (limit) {
      sessions = sessions.slice(0, limit);
    }
    return sessions;
  }
list ( { type , sort , filter , limit } ) { let sessions , index ; if ( sort === 'count' || sort === 'per_hour' ) { index = this . indexes . getIn ( [ type , '24h' ] , Map ( ) ) ; } else if ( sort === 'speed' || sort === 'per_minute' ) { index = this . indexes . getIn ( [ type , '15m' ] , Map ( ) ) ; } index = index . sort ( ) . reverse ( ) ; sessions = index . keySeq ( ) . map ( key => this . get ( type , key ) ) . filter ( s => s !== undefined ) ; if ( filter ) { sessions = sessions . filter ( filter ) ; } if ( limit ) { sessions = sessions . slice ( 0 , limit ) ; } return sessions ; }
list all sessions of a given type
list all sessions of a given type