5가지 자바스크립트(JavaScript) 라이브러리
참고 게시글(원문) URL : https://javascript.plainenglish.io/5-javascript-utility-libraries-to-improve-your-efficiency-4380b1d373c5
5 JavaScript Utility Libraries to Improve Your Efficiency
5 utility libraries 99% of people may not know about!
javascript.plainenglish.io
1. "Day.js" 사용하여 날짜/시간 형식 지정.
URL : https://day.js.org/en/
Day.js · 2kB JavaScript date utility library
2kB JavaScript date utility library
day.js.org
// using javscript only
const getData = () => {
const fillZero = (t) => [
return t < 10 ? `0${t}` : t
}
const d = new Date()
const year = d.getFullYear()
const month = fillZero(d.getMonth() + 1)
const day = fillZero(d.getDate())
const hour = fillZero(d.getHours())
const minute = fillZero(d.getMinutes())
const second = fillZero(d.getSeconds())
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
}
// using 'Day.js
console.log(dayjs().format('YYYY-MM-DD HH:mm:ss')) // 2022-05-09 07:19:14
2. "qs.js" 사용하여 URL 파라미터 형식 지정.
URL : https://github.com/ljharb/qs
GitHub - ljharb/qs: A querystring parser with nesting support
A querystring parser with nesting support. Contribute to ljharb/qs development by creating an account on GitHub.
github.com
3. "js-cookie.js" 사용하여 쿠키 읽고 쓰기
URL : https://github.com/js-cookie/js-cookie
GitHub - js-cookie/js-cookie: A simple, lightweight JavaScript API for handling browser cookies
A simple, lightweight JavaScript API for handling browser cookies - GitHub - js-cookie/js-cookie: A simple, lightweight JavaScript API for handling browser cookies
github.com
Cookies.set('name', 'test1', { expires: 10 })
Cookies.get('name') // test1
4. Lodash ??
URL : https://github.com/lodash/lodash
GitHub - lodash/lodash: A modern JavaScript utility library delivering modularity, performance, & extras.
A modern JavaScript utility library delivering modularity, performance, & extras. - GitHub - lodash/lodash: A modern JavaScript utility library delivering modularity, performance, & extras.
github.com
5. "Vconsole" 사용하여 모바일 터미널에서 웹 페이지 디버깅
URL : https://github.com/Tencent/vConsole
GitHub - Tencent/vConsole: A lightweight, extendable front-end developer tool for mobile web page.
A lightweight, extendable front-end developer tool for mobile web page. - GitHub - Tencent/vConsole: A lightweight, extendable front-end developer tool for mobile web page.
github.com