Passed
Branch v1.2 (d9458c)
by Rohit
01:37
created

toastType.js ➔ useToastType   A

Complexity

Conditions 3

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 3
1
function useToastType(toast, defaultOptions = {}) {
2
    const types = ["warn", "success", "error", "info", "primary"];
3
    const toastType = {};
4
    types.map(type => toastType[type] = (message, options = defaultOptions) => toast(message, type, options));
5
    return toastType;
6
}
7
8
export default useToastType;