整理 commons

main
Lei OT 4 months ago
parent 6f79616654
commit e58db1e5a8

@ -107,11 +107,11 @@ export function formatDate(date) {
export function formatDateToStr(date) {
if(date === ''){
return null;
}
}
const year = date.getFullYear();
const month = date.getMonth();
const day = date.getDate();
const enMonthArr = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Spt","Oct","Nov","Dec"];
const formatted = enMonthArr[month] +'. '+ day +', '+ year;
return formatted;
@ -216,17 +216,6 @@ export function prepareUrl(url) {
return new UrlBuilder(url);
}
// export function debounce(fn, delay = 500) {
// let timer
// return e => {
// e.persist()
// clearTimeout(timer)
// timer = setTimeout(() => {
// fn(e)
// }, delay)
// }
// }
export const debounce = (func, wait, immediate) => {
var timeout;
return function () {
@ -271,14 +260,6 @@ export function escape2Html(str) {
return output;
}
export function formatPrice(price) {
return Math.ceil(price).toLocaleString();
}
export function formatPercent(number) {
return Math.round(number * 100) + '%';
}
/**
* ! 不支持计算 Set Map
* @param {*} val
@ -582,8 +563,7 @@ export function objectMapper(input, keyMap, keep = true) {
let value = input[key];
if (map.transform) value = map.transform(value);
if (typeof map === 'string') mappedObj[map] = value;
mappedObj[map.key || map] = value;
// mappedObj[map.key || map] = value;
mappedObj[map.key || map] = value; // || key
}
}
});

Loading…
Cancel
Save