summaryrefslogtreecommitdiff
path: root/src/core/utils
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-02-22 11:03:34 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-02-22 11:03:34 +0700
commitf66b12fd1d0b83af0d7230d7b1565fbe00afbe3c (patch)
tree253dcf854a3c92e09ca846e86a09e5b4c5d16be1 /src/core/utils
parent3c559031623649a67825ff47f34512f0eb946861 (diff)
prettier
Diffstat (limited to 'src/core/utils')
-rw-r--r--src/core/utils/address.js5
-rw-r--r--src/core/utils/auth.js12
-rw-r--r--src/core/utils/cart.js7
-rw-r--r--src/core/utils/currencyFormat.js4
-rw-r--r--src/core/utils/getFileBase64.js21
-rw-r--r--src/core/utils/greeting.js2
-rw-r--r--src/core/utils/slug.js18
-rw-r--r--src/core/utils/toTitleCase.js11
8 files changed, 32 insertions, 48 deletions
diff --git a/src/core/utils/address.js b/src/core/utils/address.js
index b89dd924..c545d34b 100644
--- a/src/core/utils/address.js
+++ b/src/core/utils/address.js
@@ -25,7 +25,4 @@ const updateItemAddress = (key, value) => {
return
}
-export {
- getItemAddress,
- updateItemAddress
-} \ No newline at end of file
+export { getItemAddress, updateItemAddress }
diff --git a/src/core/utils/auth.js b/src/core/utils/auth.js
index 6aeba02b..13e0e79d 100644
--- a/src/core/utils/auth.js
+++ b/src/core/utils/auth.js
@@ -1,8 +1,4 @@
-import {
- deleteCookie,
- getCookie,
- setCookie
-} from 'cookies-next'
+import { deleteCookie, getCookie, setCookie } from 'cookies-next'
const getAuth = () => {
let auth = getCookie('auth')
@@ -22,8 +18,4 @@ const deleteAuth = () => {
return true
}
-export {
- getAuth,
- setAuth,
- deleteAuth
-} \ No newline at end of file
+export { getAuth, setAuth, deleteAuth }
diff --git a/src/core/utils/cart.js b/src/core/utils/cart.js
index 52e157f2..fd42ee4e 100644
--- a/src/core/utils/cart.js
+++ b/src/core/utils/cart.js
@@ -33,9 +33,4 @@ const deleteItemCart = ({ productId }) => {
return true
}
-export {
- getCart,
- getItemCart,
- updateItemCart,
- deleteItemCart
-} \ No newline at end of file
+export { getCart, getItemCart, updateItemCart, deleteItemCart }
diff --git a/src/core/utils/currencyFormat.js b/src/core/utils/currencyFormat.js
index 31f4a8dc..12b68111 100644
--- a/src/core/utils/currencyFormat.js
+++ b/src/core/utils/currencyFormat.js
@@ -1,10 +1,10 @@
const currencyFormat = (value) => {
const currency = new Intl.NumberFormat('id-ID', {
- style: 'currency',
+ style: 'currency',
currency: 'IDR',
maximumFractionDigits: 0
})
return currency.format(value)
}
-export default currencyFormat \ No newline at end of file
+export default currencyFormat
diff --git a/src/core/utils/getFileBase64.js b/src/core/utils/getFileBase64.js
index 78013e43..4fa7316b 100644
--- a/src/core/utils/getFileBase64.js
+++ b/src/core/utils/getFileBase64.js
@@ -1,11 +1,12 @@
-const getFileBase64 = file => new Promise((resolve, reject) => {
- let reader = new FileReader();
- reader.readAsBinaryString(file);
- reader.onload = () => {
- let result = reader.result;
- resolve(btoa(result));
- };
- reader.onerror = error => reject(error);
-});
+const getFileBase64 = (file) =>
+ new Promise((resolve, reject) => {
+ let reader = new FileReader()
+ reader.readAsBinaryString(file)
+ reader.onload = () => {
+ let result = reader.result
+ resolve(btoa(result))
+ }
+ reader.onerror = (error) => reject(error)
+ })
-export default getFileBase64; \ No newline at end of file
+export default getFileBase64
diff --git a/src/core/utils/greeting.js b/src/core/utils/greeting.js
index 014c0e3c..aaaade7a 100644
--- a/src/core/utils/greeting.js
+++ b/src/core/utils/greeting.js
@@ -6,4 +6,4 @@ const greeting = () => {
return 'Selamat Malam'
}
-export default greeting \ No newline at end of file
+export default greeting
diff --git a/src/core/utils/slug.js b/src/core/utils/slug.js
index fab37330..7010008a 100644
--- a/src/core/utils/slug.js
+++ b/src/core/utils/slug.js
@@ -1,15 +1,21 @@
import toTitleCase from './toTitleCase'
const createSlug = (prefix, name, id) => {
- let slug = name?.trim().replace(new RegExp(/[^A-Za-z0-9]/, 'g'), '-').toLowerCase() + '-' + id
+ let slug =
+ name
+ ?.trim()
+ .replace(new RegExp(/[^A-Za-z0-9]/, 'g'), '-')
+ .toLowerCase() +
+ '-' +
+ id
let splitSlug = slug.split('-')
- let filterSlugFromEmptyChar = splitSlug.filter(x => x != '')
+ let filterSlugFromEmptyChar = splitSlug.filter((x) => x != '')
return prefix + filterSlugFromEmptyChar.join('-')
}
const getIdFromSlug = (slug) => {
let id = slug.split('-')
- return id[id.length-1]
+ return id[id.length - 1]
}
const getNameFromSlug = (slug) => {
@@ -18,8 +24,4 @@ const getNameFromSlug = (slug) => {
return toTitleCase(name.join(' '))
}
-export {
- createSlug,
- getIdFromSlug,
- getNameFromSlug
-} \ No newline at end of file
+export { createSlug, getIdFromSlug, getNameFromSlug }
diff --git a/src/core/utils/toTitleCase.js b/src/core/utils/toTitleCase.js
index b2751f0b..4335824d 100644
--- a/src/core/utils/toTitleCase.js
+++ b/src/core/utils/toTitleCase.js
@@ -1,10 +1,7 @@
const toTitleCase = (str) => {
- return str.replace(
- /\w\S*/g,
- function(txt) {
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
- }
- );
+ return str.replace(/\w\S*/g, function (txt) {
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
+ })
}
-export default toTitleCase \ No newline at end of file
+export default toTitleCase