Commit 5d90c706 authored by Phil Hughes's avatar Phil Hughes

fixed getters

parent 55b91d94
import { __ } from '~/locale'; import { __ } from '~/locale';
import { getChangesCountForState, filePathMatches } from './utils'; import { getChangesCountForFiles, filePathMatches } from './utils';
export const activeFile = state => state.openFiles.find(file => file.active) || null; export const activeFile = state => state.openFiles.find(file => file.active) || null;
...@@ -69,10 +69,10 @@ export const getChangesInFolder = state => path => { ...@@ -69,10 +69,10 @@ export const getChangesInFolder = state => path => {
}; };
export const getUnstagedFilesCountForPath = state => path => export const getUnstagedFilesCountForPath = state => path =>
getChangesCountForState(state.changesFiles, path); getChangesCountForFiles(state.changedFiles, path);
export const getStagedFilesCountForPath = state => path => export const getStagedFilesCountForPath = state => path =>
getChangesCountForState(state.stagedFiles, path); getChangesCountForFiles(state.stagedFiles, path);
// prevent babel-plugin-rewire from generating an invalid default during karma tests // prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {}; export default () => {};
...@@ -141,5 +141,5 @@ export const sortTree = sortedTree => ...@@ -141,5 +141,5 @@ export const sortTree = sortedTree =>
export const filePathMatches = (f, path) => export const filePathMatches = (f, path) =>
f.path.replace(new RegExp(`${f.name}$`), '').indexOf(`${path}/`) === 0; f.path.replace(new RegExp(`${f.name}$`), '').indexOf(`${path}/`) === 0;
export const getChangesCountForState = (state, path) => export const getChangesCountForFiles = (files, path) =>
state.stagedFiles.filter(f => filePathMatches(f, path)).length; files.filter(f => filePathMatches(f, path)).length;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment