@mic-rexjs/usecases-react
Version:
React-based solution for use usecases of Clean Architecture
20 lines (19 loc) • 494 B
JavaScript
import { ArgumentTypes } from '../../enums/ArgumentTypes';
export const useFullArguments = (args, argumentTypes) => {
const [arg1, arg2, arg3, arg4] = args;
const withoutEntity = (argumentTypes & ArgumentTypes.Entity) !== ArgumentTypes.Entity;
if (withoutEntity) {
return [
null,
arg1,
(arg2 || {}),
(arg3 || []),
];
}
return [
arg1,
arg2,
(arg3 || {}),
(arg4 || []),
];
};