<commit_before>// @flow
import createPoint from 'recall-action'

export const state = []

const actions = {
  ADD_TRACKS (tracks) {
    state.push(...tracks)
  },
  DROP () {
    state.length = 0
  }
}

const point = createPoint(
  (ACTION, ...params) => {
    if (ACTION) {
      actions[ACTION](...params)
    }
    return state
  }
)

export default point<commit_msg>playlist state merged with currentTrack<commit_after>// @flow
import createPoint from 'recall-action'
import getRandomString from '../utils/getRandomString'

export const state = []

const actions = {
  ADD_TRACKS (tracks) {
    const _tracks = tracks.map(
      (trackObj) => {
        const id = getRandomString()
        return {
          ...trackObj,
          id,
          current: false
        }
      }
    )
    state.push(..._tracks)
  },
  DROP () {
    state.length = 0
  },
  SET_CURRENT (nextCurrentId) {
    const current = state.find(
      ({ current }) => current
    )
    if (current) {
      current.current = false
    }
    const target = state.find(
      ({ id }) => nextCurrentId === id
    )
    target.current = true
  },
  DROP_CURRENT () {
    const current = state.find(
      ({ current }) => current
    )
    if (current) {
      current.current = false
    }
  }
}

const point = createPoint(
  (ACTION, ...params) => {
    if (ACTION) {
      actions[ACTION](...params)
    }
    return state
  }
)

export default point
{'fraction_non_alphanumeric': 0.13725490196078433, 'fraction_numerical': 0.0014005602240896359, 'mean_word_length': 2.093073593073593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7619898', 'n_tokens_mistral': 464, 'n_tokens_neox': 456, 'n_words': 108}