mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
16 lines
454 B
JavaScript
16 lines
454 B
JavaScript
import currify from 'currify';
|
|
|
|
const not = currify((array, value) => !array.includes(value));
|
|
const notOneOf = currify((a, b) => a.filter(not(b)));
|
|
|
|
export const getNextCurrentName = (currentName, names, removedNames) => {
|
|
const i = names.indexOf(currentName);
|
|
|
|
const nextNames = notOneOf(names, removedNames);
|
|
const {length} = nextNames;
|
|
|
|
if (nextNames[i])
|
|
return nextNames[i];
|
|
|
|
return nextNames[length - 1];
|
|
};
|