This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let clientId = '' | |
| let clientSecret = '' | |
| let token = '' | |
| let randomId = '' // ํด๋ผ์ด์ธํธ์๊ฒ ์ ๋ฌ๋ ๊ฐ | |
| const naverLogin = async () => { | |
| let accessTokenRequestURL = `https://nid.naver.com/oauth2.0/token?client_id=${clientId}&client_secret=${clientSecret}&grant_type=authorization_code&state=${randomId}&code=${token}` | |
| let auctualTokenRequestResponse = await axios.get( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import puppeteer from 'puppeteer-extra'; | |
| import pluginStealth from 'puppeteer-extra-plugin-stealth'; // Use v2.4.5 instead of latest | |
| import * as readline from 'readline'; | |
| puppeteer.use(pluginStealth()); | |
| // Use '-h' arg for headful login. | |
| const headless = !process.argv.includes('-h'); | |
| // Prompt user for email and password. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const viewKorean = (num: any): string => { | |
| num = parseInt((num + '').replace(/[^0-9]/g, ''), 10) + ''; | |
| if (num == '0') return '์'; | |
| let number = ['์', '์ผ', '์ด', '์ผ', '์ฌ', '์ค', '์ก', '์น ', 'ํ', '๊ตฌ']; | |
| let unit = ['', '๋ง', '์ต', '์กฐ']; | |
| let smallUnit = ['์ฒ', '๋ฐฑ', '์ญ', '']; | |
| let result = []; | |
| let unitCnt = Math.ceil(num.length / 4); | |
| num = num.padStart(unitCnt * 4, '0'); | |
| let regexp = /[\w\W]{4}/g; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function removeDot(str: string): string { | |
| return str.replace(/(^0)(?=[^.])/, ''); | |
| } | |
| export function replComma(str: string): string { | |
| return removeDot(str.replace(/(^[\d,]+\.(?:\d*[^0])?)(0*)$/, '$1').replace(/\.$/, '')); | |
| } | |
| export function addComma(str: string): string { | |
| return str.replace(/\B(?=(\d{3})+(?!\d))/g, ','); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function search(nameKey: any, myArray: any, attribute: string){ | |
| for (let i=0; i < myArray.length; i++) { | |
| if (myArray[i][attribute] === nameKey) { | |
| return myArray[i]; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getLineChartD = ({ data, size, width, padding, topSpacing }) => { | |
| const min = Math.min(...data); | |
| const max = Math.max(...data); | |
| const d = data | |
| .map((v, i) => { | |
| return `${i === 0 ? 'M' : 'L'} ${(i * (width - padding * 5)) / data.length},${ | |
| size - (v / (max - min)) * size + (topSpacing || 0) | |
| }`; | |
| }).join(' '); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function emailSecurity(userEmail: string){ | |
| const id = userEmail.split('@')[0]; | |
| const mail = userEmail.split('@')[1]; | |
| const maskingId = function(id: string) { | |
| let splitId = id.substring(0,4); | |
| for(let i = 4; i < id.length; i++) { | |
| splitId += '*'; | |
| } | |
| return splitId; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function duplicateCheck(array: any[]) { | |
| return array.reduce((t, a) => { | |
| t[a] = (t[a] || 0) + 1; | |
| return t | |
| }, {}) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const paginate = (array: any, index: any, size: any) => { | |
| // transform values | |
| index = Math.abs(parseInt(index)); | |
| index = index > 0 ? index - 1 : index; | |
| size = parseInt(size); | |
| size = size < 1 ? 1 : size; | |
| // filter | |
| return [ | |
| ...array.filter((value: any, n: any) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import moment from 'moment' | |
| import 'moment-duration-format' | |
| let currentMoment = moment() | |
| let currentMinuteNum = Number(currentMoment.format('mm')) | |
| let nextMin = 1 | |
| let _nextContractTime = moment(currentMoment) | |
| .add(nextMin, 'minute') |