\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{tronghao} \pdfinfo{ /Title (haodt-lodash.pdf) /Creator (Cheatography) /Author (tronghao) /Subject (haodt-lodash Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{EDBE21} \definecolor{LightBackground}{HTML}{FDFAF1} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{haodt-lodash Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{tronghao} via \textcolor{DarkBackground}{\uline{cheatography.com/174041/cs/36916/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}tronghao \\ \uline{cheatography.com/tronghao} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 5th February, 2023.\\ Updated 12th February, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Blog}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{link="https://blogcongnghe.tronghao.com/lodash"\}\}https://blogcongnghe.tronghao.com/lodash\{\{/link\}\}% Row Count 2 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Tách ra}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{\_.chunk} & Tách array chính ra thành những array con với số lượng nhất định. \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{\_.unzip} & Tạo những array theo vị trí của các array. \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{String}}} \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{\_.words} & Cắt các chữ trong string bỏ vào mảng. \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.64701 cm} x{4.32999 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Thay thế}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{\_.fill} & Thay thế thành …(ký tự nào đó) bắt đầu từ đâu đến đâu (không tính end). \tn % Row Count 4 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Tìm kiếm}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `\_.findIndex` & `\_.findIndex(array, {[}predicate=\_.identity{]}, {[}fromIndex=0{]})`\{\{nl\}\}Tìm vị trí của item đầu tiên thỏa điều kiện. \tn % Row Count 7 (+ 6) % Row 2 \SetRowColor{LightBackground} \seqsplit{\_.findLastIndex} \{\{noshy\}\} & Tìm vị trí của item cuối cùng thỏa điều kiện. \tn % Row Count 10 (+ 3) % Row 3 \SetRowColor{white} \_.indexOf & Search item in array, return index tìm thấy. \tn % Row Count 12 (+ 2) % Row 4 \SetRowColor{LightBackground} \_.findKey & Tìm và trả về key của một phần tử. \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.84609 cm} x{4.13091 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lọc}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{\_.filter} & Lọc ra item theo điều kiện. \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{\_.find} & Lọc ra item theo điều kiện. Tương tự hàm \_.filter \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{\_.reduce} & Lọc giống như filter nhưng trả về dạng object group\_by.\{\{nl\}\}Lưu ý: Cần return và đối số thứ ba là \{\}, là kết quả mặc định khi không có dữ liệu. \tn % Row Count 11 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.69218 cm} x{3.28482 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lặp}} \tn % Row 0 \SetRowColor{LightBackground} \_.map & Tạo ra mảng mới sau khi xử lý cái gì đó ở mảng cũ. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \_.mapValues \{\{noshy\}\} & Trả về object mới từ object cũ sau khi đã xử lý gì đó. \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \_.foreach & Lặp qua các element. \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.44333 cm} x{3.53367 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Hạ Cấp}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \_.flatten & Hạ cấp mảng xuống 1 level. \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{\_.flattenDeep} & Hạ cấp mảng về level 1. \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{\_.flattenDepth} & Hạ cấp mảng xuống n level. \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Tạo Object}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \_.fromPairs & Tạo object từ {[}key, value{]} trong array. \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \_.zipObject & Lấy array 1 làm key, Lấy array 2 làm value. \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} \seqsplit{\_.zipObjectDeep} \{\{noshy\}\} & Giống trên nhưng phức tạp hơn. \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Object}}} \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} \_.cloneDeep \{\{noshy\}\} & Tạo object mới ở địa chỉ mới, để khi thay đổi không ảnh hưởng object ban đầu. \tn % Row Count 14 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Nghịch đảo}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{\_.reverse} & Đảo ngược phần tử của mảng. \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Gom nhóm}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \_.groupBy & Gom nhóm object. \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Duy nhất}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{\_.union} & Lấy ra những item duy nhất của một hoặc nhiều array. \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{\_.unionBy} & Lấy ra những item duy nhất của một hoặc nhiều array nhưng có thêm điều kiện. \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} \_.uniq & Lấy ra những item duy nhất của một array. \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{\_.uniqBy} & Lấy ra những item duy nhất của một array nhưng theo điều kiện. \tn % Row Count 13 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Xóa}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \_.compact & Xóa những dữ liệu là false khỏi array.\{\{nl\}\}Những dữ liệu là false: false, 0, empty, null, undefined, NaN \tn % Row Count 7 (+ 6) % Row 2 \SetRowColor{LightBackground} \_.drop & Cắt n phần tử từ vị trí đầu tiên. \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} \_.dropRight & Cắt n phần tử từ vị trí cuối cùng. \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{\_.dropRightWhile} \{\{noshy\}\} & Cắt n phần tử từ vị trí cuối cùng với điều kiện nào đó. \tn % Row Count 15 (+ 4) % Row 5 \SetRowColor{white} \_.dropWhile & Cắt n phần tử từ vị trí đầu tiên với điều kiện nào đó. \tn % Row Count 19 (+ 4) % Row 6 \SetRowColor{LightBackground} \_.initial & Bỏ phần tử cuối cùng của mảng. \tn % Row Count 21 (+ 2) % Row 7 \SetRowColor{white} \_.pull & Xóa các item có giá trị bằng với item value khỏi mảng. \tn % Row Count 24 (+ 3) % Row 8 \SetRowColor{LightBackground} \_.pullAll & Giống \_.pull nhưng value dạng array. \tn % Row Count 26 (+ 2) % Row 9 \SetRowColor{white} \_.pullAllBy & Giống \_.pull nhưng kèm điều kiện. \tn % Row Count 28 (+ 2) % Row 10 \SetRowColor{LightBackground} \_.pullAt & Loại bỏ item tại các index. \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Xóa (cont)}} \tn % Row 11 \SetRowColor{LightBackground} \_.remove & Xóa theo điều kiến. Xóa luôn item trong array gốc. \tn % Row Count 3 (+ 3) % Row 12 \SetRowColor{white} \_.without & Xóa item có trong mảng giống với các value. \tn % Row Count 6 (+ 3) % Row 13 \SetRowColor{LightBackground} \_.sortedUniq & Bỏ phần tử trùng, tối ưu hóa cho mảng đã sắp xếp. \tn % Row Count 9 (+ 3) % Row 14 \SetRowColor{white} \_.sortedUniqBy & Bỏ phần tử trùng, tối ưu hóa cho mảng đã sắp xếp. Nhưng có thêm điều kiện. \tn % Row Count 14 (+ 5) % Row 15 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{String}}} \tn % Row Count 15 (+ 1) % Row 16 \SetRowColor{white} \_.trim & Bỏ khoảng trắng hai đầu. \tn % Row Count 17 (+ 2) % Row 17 \SetRowColor{LightBackground} \_.trimStart & Bỏ khoảng trắng bên trái. \tn % Row Count 19 (+ 2) % Row 18 \SetRowColor{white} \_.trimEnd & Bỏ khoảng trắng bên phải. \tn % Row Count 21 (+ 2) % Row 19 \SetRowColor{LightBackground} \_.truncate & Cắt string và thêm dấu "…" vào nếu string dài quá length. \tn % Row Count 25 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.04057 cm} x{2.93643 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Sắp xếp}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \_.sortedIndex & Xác định vị trí chèn vào mảng, có giá trị gần với giá trị cần chèn nhất và nhỏ hơn giá trị cần chèn. \tn % Row Count 7 (+ 6) % Row 2 \SetRowColor{LightBackground} \_.sortedIndexBy & Xác định vị trí chèn vào mảng, có giá trị gần với giá trị cần chèn nhất và nhỏ hơn giá trị cần chèn. Nhưng có thêm điều kiện. \tn % Row Count 15 (+ 8) % Row 3 \SetRowColor{white} \_.sortedIndexOf & Xác định vị trí chèn vào mảng đã được sắp xếp, có giá trị gần với giá trị cần chèn nhất và nhỏ hơn giá trị cần chèn. \tn % Row Count 23 (+ 8) % Row 4 \SetRowColor{LightBackground} \seqsplit{\_.sortedLastIndex} & Xác định vị trí chèn vào mảng, có giá trị gần với giá trị cần chèn nhất và lớn hơn giá trị cần chèn. \tn % Row Count 29 (+ 6) % Row 5 \SetRowColor{white} \_.sortedLastIndexBy\{\{noshy\}\} & Xác định vị trí chèn vào mảng, có giá trị gần với giá trị cần chèn nhất và lớn hơn giá trị cần chèn. Nhưng có thêm điều kiện. \tn % Row Count 37 (+ 8) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.04057 cm} x{2.93643 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Sắp xếp (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \_.orderBy & Sắp xếp mảng. \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Kiểm tra}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\_.isNull} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\_.isFunction} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\_.isUndefined} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\_.isNumber} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\_.isObject} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\_.isDate} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\_.isEmpty} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \_.startsWith \{\{noshy\}\} & Kiểm tra chuỗi có nằm ở đầu string cần so sánh. \tn % Row Count 10 (+ 3) % Row 8 \SetRowColor{LightBackground} \_.endsWith & Kiểm tra chuỗi có nằm ở cuối string cần so sánh. \tn % Row Count 13 (+ 3) % Row 9 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Object}}} \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{LightBackground} \_.has & Kiểm tra object có property hay function nào đó không. \tn % Row Count 17 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Object and Array}}} \tn % Row Count 18 (+ 1) % Row 12 \SetRowColor{LightBackground} \_.every & true =\textgreater{} nếu tất cả phần tử thỏa điều kiện. \tn % Row Count 21 (+ 3) % Row 13 \SetRowColor{white} \_.some & true =\textgreater{} nếu một trong các phần tử thỏa điều kiện \tn % Row Count 24 (+ 3) % Row 14 \SetRowColor{LightBackground} \_.includes & Kiểm tra giá trị có nằm trong collection không. \tn % Row Count 27 (+ 3) % Row 15 \SetRowColor{white} \_.isEqual & Kiểm tra có giống nhau không. \tn % Row Count 29 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Biến đổi}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{String}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \_.camelCase\{\{noshy\}\} & Chuyển chữ dạng camel case. \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \_.capitalize & Viết hoa chữ cái đầu. \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \_.pad & Bổ sung chữ bằng cách thêm ký tự 2 bên. \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \_.padStart & Bổ sung chữ bằng cách thêm ký tự bên trái. \tn % Row Count 10 (+ 3) % Row 5 \SetRowColor{white} \_.padEnd & Bổ sung chữ bằng cách thêm ký tự bên phải. \tn % Row Count 13 (+ 3) % Row 6 \SetRowColor{LightBackground} \_.startCase & Viết hoa chữ cái đầu mỗi chữ. \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} \_.deburr & Chuyển chữ có dấu thành chữ không dấu. \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Toán học}} \tn % Row 0 \SetRowColor{LightBackground} \_.max & Trả về item lớn nhất trong array. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{\_.ceil} & Làm tròn số lên.\{\{nl\}\}5.1 ==\textgreater{} 6\{\{nl\}\}5.6 ==\textgreater{} 6 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{\_.floor} & Làm tròn số xuống.\{\{nl\}\}5.1 ==\textgreater{} 5\{\{nl\}\}5.6 ==\textgreater{} 5 \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{\_.round} & Làm tròn số theo cách thông thường. \textgreater{} 5 lên. \textless{} 5 xuống.\{\{nl\}\}5.1 ==\textgreater{} 5\{\{nl\}\}5.6 ==\textgreater{} 6 \tn % Row Count 9 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Nối}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{\_.concat} & Nối các phần tử của một hoặc nhiều mảng vào mảng khác. \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \_.join & Nối các phần tử lại bằng ký tự gì đó. \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \_.zip & Gom những vị trí lại thành một mảng. \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{\_.zipWith} & Giống trên nhưng có xử lý thêm điều kiện gì đó. \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Object}}} \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} \seqsplit{\_.merge} & Gộp object thành 1 object, không ghi đè undefined. \tn % Row Count 13 (+ 2) % Row 7 \SetRowColor{white} \seqsplit{\_.assign} & Gộp object thành 1 object, có ghi đè undefined. \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{So sánh và lấy}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Array}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \_.difference & Lấy các item có trong mảng này mà không có không mảng kia. \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \_.differenceBy & Tương tự .\_difference nhưng nó sẽ áp dụng tham số thứ 3 apply vào hoặc làm điều kiện so sánh. \tn % Row Count 9 (+ 5) % Row 3 \SetRowColor{white} \_.head & Lấy phần tử đầu tiên của mảng. Giống với \_.first(array) \tn % Row Count 13 (+ 4) % Row 4 \SetRowColor{LightBackground} \_.intersection & Lấy những phần tử giống nhau của các mảng. \tn % Row Count 16 (+ 3) % Row 5 \SetRowColor{white} \seqsplit{\_.intersectionBy} & Giống intersection nhưng nó sẽ áp dụng tham số thứ 3 apply vào hoặc làm điều kiện so sánh. \tn % Row Count 21 (+ 5) % Row 6 \SetRowColor{LightBackground} \_.last & Lấy phần tử cuối cùng của array. \tn % Row Count 23 (+ 2) % Row 7 \SetRowColor{white} \_.lastIndexOf & Tìm phần tử cuối cùng giống value search \tn % Row Count 26 (+ 3) % Row 8 \SetRowColor{LightBackground} \_.nth & Lấy phần tử thứ i của array \tn % Row Count 28 (+ 2) % Row 9 \SetRowColor{white} \_.slice & Lấy từ đâu tới đâu, không bao gồm phần tử cuối. \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{So sánh và lấy (cont)}} \tn % Row 10 \SetRowColor{LightBackground} \_.tail & Lấy tất cả nhưng bỏ phần tử đầu. \tn % Row Count 2 (+ 2) % Row 11 \SetRowColor{white} \_.take & Tạo một mảng với n phần tử cắt từ vị trí đầu tiên. \tn % Row Count 6 (+ 4) % Row 12 \SetRowColor{LightBackground} \_.takeRight & Tạo một mảng với n phần tử cắt từ vị trí cuối cùng. \tn % Row Count 10 (+ 4) % Row 13 \SetRowColor{white} \seqsplit{\_.takeRightWhile} \{\{noshy\}\} & Lấy các phần tử theo điều kiện từ vị trí cuối. \tn % Row Count 13 (+ 3) % Row 14 \SetRowColor{LightBackground} \_.takeWhile & Lấy các phần tử theo điều kiện bắt đầu từ vị trí đầu tiên. \tn % Row Count 17 (+ 4) % Row 15 \SetRowColor{white} \_.xor & Lấy những item khác nhau của những array. \tn % Row Count 20 (+ 3) % Row 16 \SetRowColor{LightBackground} \_.xorBy & Giống trên nhưng có xử lý thêm gì đó. \tn % Row Count 23 (+ 3) % Row 17 \SetRowColor{white} \_.xorWith & Giống trên nhưng có thêm điều kiện. \tn % Row Count 25 (+ 2) % Row 18 \SetRowColor{LightBackground} \_.size & Length của array, object, string \tn % Row Count 27 (+ 2) % Row 19 \SetRowColor{white} \_.keyBy & Lấy dữ liệu dễ hơn dạng mảng và object. \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{So sánh và lấy (cont)}} \tn % Row 20 \SetRowColor{LightBackground} \_.reject & Trả về array chứa các element không thỏa điều kiện của tham số thứ hai. \tn % Row Count 4 (+ 4) % Row 21 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Object}}} \tn % Row Count 5 (+ 1) % Row 22 \SetRowColor{LightBackground} \_.functions & Trả về tên toàn bộ những function của 1 object. \tn % Row Count 8 (+ 3) % Row 23 \SetRowColor{white} \_.keys & Trả về toàn bộ key của object. \tn % Row Count 10 (+ 2) % Row 24 \SetRowColor{LightBackground} \_.pick & Chỉ lấy 1 số thuộc tính của object. \tn % Row Count 12 (+ 2) % Row 25 \SetRowColor{white} \_.pickBy & Chỉ lấy 1 số thuộc tính của object theo điều kiện. \tn % Row Count 15 (+ 3) % Row 26 \SetRowColor{LightBackground} \_.omit & Bỏ một số thuộc tính của object, lấy những thuộc tính còn lại. \tn % Row Count 19 (+ 4) % Row 27 \SetRowColor{white} \_.omitBy & Bỏ một số thuộc tính của object theo điều kiện, lấy những thuộc tính còn lại. \tn % Row Count 24 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Tiện ích}} \tn % Row 0 \SetRowColor{LightBackground} \_.times & Thực hiện số lần cụ thể cho function và trả về array kết quả. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \_.delay & Sau một khoảng thời gian, chỉ chạy một lần. Giống setTimeout. \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{\_.debounce} & Gọi một function sau một khoảng thời gian function đó được gọi. Giống setIntervel \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} `\_.get` & `\_.get(object, 'a.b.c', 'default');`\{\{nl\}\}Lấy dữ liệu mà không bị lỗi undefined. \tn % Row Count 13 (+ 3) % Row 4 \SetRowColor{LightBackground} `\_.set` & `\_.set(object, {[}'x', '0', 'y', 'z'{]}, 5);`\{\{nl\}\}Gán dữ liệu mà không bị lỗi undefined. \tn % Row Count 16 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}