1. pipe
const pipe = (...functions) =>
(args) => functions.reduce((arg, nextFn) => nextFn(arg), args)
2. 천단위 콤마
const numberComma = (number) =>
number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
3. cookie 핸들러
const setCookie = (key, value, days) =>
{
var exdate = new Date();
exdate.setDate(exdate.getDate() + days);
var cookie_value = escape(value) + ((days == null) ? '' : '; expires=' + exdate.toUTCString());
document.cookie = key + '=' + cookie_value;
}
const getCookie = (key) =>
{
var value = "; " + document.cookie;
var parts = value.split("; " + key + "=");
if (parts.length == 2) return
parts.pop().split(";").shift();
};
const deleteCookie = (key) =>
{
document.cookie = key + "=; expires=Thu, 01 Jan 1999 00:00:10 GMT;";
};