Lodash

本页使用了标题或全文手工转换
维基百科,自由的百科全书
Lodash
原作者John-David Dalton
開發者OpenJS 基金會[1]
首次发布2012年4月23日,​11年前​(2012-04-23[2]
当前版本
  • 4.0.0 (2016年1月12日;穩定版本)[3][4]
  • 4.17.21 (2021年2月20日;穩定版本)[5][4]
編輯維基數據鏈接
源代码库 編輯維基數據鏈接
编程语言JavaScript
平台跨平臺
类型JavaScript函式庫
许可协议MIT許可證[6]
网站lodash.com/ 编辑维基数据

Lodash開放源碼JavaScript函式庫,透過函式語言程式設計模式提供開發者常用的函式。[7]

概覽

Lodash是基於Underscore.js分叉,許多函式與功能好似Underscore.js。[8]Underscore.js的創辦人是同為CoffeeScript的創辦人Jeremy Ashkenas英语Jeremy Ashkenas。Underscore.js許多開發人員也對開發Lodash有所貢獻。[9][10]

Lodash是目前在npm上最多JavaScript軟體使用的開源軟體套件,每週下載達三千三百萬次以上。[11][12]Lodash在開源軟體的廣泛使用令此套件曾遭依賴注入漏洞攻擊。[13][14]

範例

Lodash包括陣列排序算法和過濾、集合的演算法、數學函式、與字符串的變更函式,共過百條函式。[15]Lodash用的函式語言程式設計模式允許開發者同時串連英语Method Chaining多條函式,比如,同時排序和顛倒一列包括數字的陳列可用以下句法[15]

const _ = require('lodash')

const numbers = [2,5,4,3,1]
const sorted_numbers = _(numbers).sortBy().reverse().value();

// 結果: numbers = [5,4,3,2,1]

参考文献

  1. ^ OpenJS Foundation Hosted Projects. [2020-07-23]. (原始内容存档于2020-07-19). 
  2. ^ Lodash Releases. GitHub. [2020-07-23]. (原始内容存档于2021-01-25). 
  3. ^ Release 4.0.0. 2016年1月12日 [2018年12月6日]. 
  4. ^ 4.0 4.1 https://registry.npmjs.com/lodash; 检索日期: 2023年3月8日.
  5. ^ https://github.com/lodash/lodash/releases/tag/4.17.21; 出版日期: 2021年2月20日; 检索日期: 2021年12月26日.
  6. ^ Lodash/LICENSE.md. GitHub. [2020-07-23]. (原始内容存档于2020-12-20). 
  7. ^ Lodash. Lodash Functional Programming Guide. [2020-07-24]. (原始内容存档于2021-01-21). 
  8. ^ 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). 
  9. ^ Jeremy Ashkenas. Jeremy Ashkenas Biography. New York Times. [2020-07-24]. (原始内容存档于2021-01-12). 
  10. ^ Underdash Github Issues: Lodash, underscore merge and usage discussion. Github. [2020-07-24]. (原始内容存档于2020-10-12). 
  11. ^ npm most depended upon packages. [2020-07-24]. (原始内容存档于2020-12-04). 
  12. ^ lodash on npm. [2020-07-24]. (原始内容存档于2021-02-04). 
  13. ^ Catalin Cimpanu. More than 75% of all vulnerabilities reside in indirect dependencies. ZDNet. 2020-06-20 [2020-07-24]. (原始内容存档于2021-01-19). 
  14. ^ Lodash Github Issues: High severity vulnerability in 4.17.11. Github. 2019-07-02 [2020-07-24]. (原始内容存档于2020-11-11). 
  15. ^ 15.0 15.1 Lodash. Lodash Docs. [2020-07-23]. (原始内容存档于2021-01-23). 

外部链接