All files / src/store/reducers calculateSequencesState.js

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                        6x 12x       1084x 12x      
/**
* Copyright 2018, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
 
import {
  reduce,
} from 'lodash-es';
 
const calculateSequencesState = (prevState, sequences) => {
  const state = {
    raw: sequences,
    length: sequences.length,
  };
  state.maxLength = reduce(sequences, (m, e) => Math.max(m, e.sequence.length), 0);
  return state;
}
export default calculateSequencesState;