데이터를 정렬/필터/색인할 수 있게 도와주는 오픈소스 Javascript Utility Library
사용방법
https://lodash.com/ 에서 [CDN copies]를 통해 CDN을 가져오거나
파일 다운로드 (https://github.com/lodash/lodash/releases)
<script src="lodash.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.min.js"></script>
기능
https://lodash.com/docs/4.17.11 을 참조하여 사용
대표예시
_.orderby
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>lodash</title>
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.min.js"></script>
</head>
<body>
<script>
var kids = [
{ name: 'Stan', strength: 70, intelligence: 70 },
{ name: 'Kyle', strength: 40, intelligence: 80 },
{ name: 'Eric', strength: 45, intelligence: 80 },
{ name: 'Kenny', strength: 100, intelligence: 70 }
]
// intelligence, DESC로 1차정렬
// strength, ASC로 2차정렬
_.orderBy(kids, ['intelligence', 'strength'], [desc, asc])
</script>
</body>
</html>
'FrontEnd > Javascript Library' 카테고리의 다른 글
BootBox.js 버튼 포커싱하기 (0) | 2019.02.07 |
---|---|
BootStrap CDN 시작하기 (0) | 2019.01.14 |