getters.js 274 B

123456789101112
  1. export const count = state => state.count
  2. const limit = 5
  3. export const recentHistory = state => {
  4. const end = state.history.length
  5. const begin = end - limit < 0 ? 0 : end - limit
  6. return state.history
  7. .slice(begin, end)
  8. .toString()
  9. .replace(/,/g, ', ')
  10. }