Lodash

本页使用了标题或全文手工转换
维基百科,自由的百科全书
Lodash
原作者John-David Dalton
开发者OpenJS 基金会[1]
首次发布2012年4月23日,​12年前​(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). 

外部链接