Lodash
(重定向自Underscore.js)
跳到导航
跳到搜索
| 原作者 | John-David Dalton |
|---|---|
| 開發者 | OpenJS 基金會[1] |
| 初始版本 | 2012年4月23日[2] |
| 穩定版本 | 4.17.20 (2020年8月13日[2]) |
| 源代码库 | |
| 编程语言 | JavaScript |
| 系統平台 | 跨平臺 |
| 类型 | JavaScript函式庫 |
| 许可协议 | MIT許可證[3] |
| 网站 | https://lodash.com/ |
Lodash是一個開放源碼的JavaScript函式庫。Lodash的目的是透過函式語言程式設計的模式提供開發者常用的函式。[4]
概覽[编辑]
Lodash是基於Underscore.js的分叉,其許多函式與功能與Underscore.js相似。[5]Underscore.js的創辦人是同為CoffeeScript的創辦人Jeremy Ashkenas。許多Underscore.js的開發人員也對Lodash的開發有所貢獻。[6][7]
Lodash是目前在npm上最多JavaScript軟體使用的開放原始碼軟體套件,每週下載次數三千三百萬次以上。[8][9]Lodash在開源軟體的廣泛使用讓此套件曾經成為依賴注入的漏洞攻擊。[10][11]
範例[编辑]
Lodash包含陣列的排序算法和過濾、集合的演算法、數學函式、與字符串的變更函式,共包含超過一百個函式。[12]Lodash使用的函式語言程式設計模式允許開發者同時串連多數個函式。比如,如果要同時排序和顛倒一個包含數字的陳列,可以使用以下句法:[12]
const _ = require('lodash')
const numbers = [2,5,4,3,1]
const sorted_numbers = _(numbers).sortBy().reverse().value();
// 結果: numbers = [5,4,3,2,1]
参考文献[编辑]
- ^ OpenJS Foundation Hosted Projects. [2020-07-23]. (原始内容存档于2020-07-19).
- ^ 2.0 2.1 Lodash Releases. GitHub. [2020-07-23]. (原始内容存档于2021-01-25).
- ^ Lodash/LICENSE.md. GitHub. [2020-07-23]. (原始内容存档于2020-12-20).
- ^ Lodash. Lodash Functional Programming Guide. [2020-07-24]. (原始内容存档于2021-01-21).
- ^ Albert Ziegler. Lodash vs Underscore: Dash of the titans. Semmle Official Blog, a Github/Microsoft Company. 2017-10-26 [2020-07-24]. (原始内容存档于2020-07-24).
- ^ Jeremy Ashkenas. Jeremy Ashkenas Biography. New York Times. [2020-07-24]. (原始内容存档于2021-01-12).
- ^ Underdash Github Issues: Lodash, underscore merge and usage discussion. Github. [2020-07-24]. (原始内容存档于2020-10-12).
- ^ npm most depended upon packages. [2020-07-24]. (原始内容存档于2020-12-04).
- ^ lodash on npm. [2020-07-24]. (原始内容存档于2021-02-04).
- ^ Catalin Cimpanu. More than 75% of all vulnerabilities reside in indirect dependencies. ZDNet. 2020-06-20 [2020-07-24]. (原始内容存档于2021-01-19).
- ^ Lodash Github Issues: High severity vulnerability in 4.17.11. Github. 2019-07-02 [2020-07-24]. (原始内容存档于2020-11-11).
- ^ 12.0 12.1 Lodash. Lodash Docs. [2020-07-23]. (原始内容存档于2021-01-23).
外部链接[编辑]
- Lodash 網站 (页面存档备份,存于互联网档案馆)
- Lodash 中文文檔 (页面存档备份,存于互联网档案馆)
- Lodash 原始碼 (页面存档备份,存于互联网档案馆)