I created Lo-Dash to provide more consistent cross-environment iteration support for arrays, strings, objects, and arguments
objects 1 .
(我创建了Lo-Dash,为数组,字符串,对象和arguments
对象1提供更一致的跨环境迭代支持。)
It has since become a superset of Underscore, providing more consistent API behavior, more features (like AMD support, deep clone, and deep merge), more thorough documentation and unit tests (tests which run in Node, Ringo, Rhino, Narwhal, PhantomJS, and browsers), better overall performance and optimizations for large arrays/object iteration, and more flexibility with custom builds and template pre-compilation utilities. (它已成为Underscore的超集,提供更一致的API行为,更多功能 (如AMD支持,深度克隆和深度合并),更全面的文档和单元测试(在Node,Ringo,Rhino,Narwhal,PhantomJS中运行的测试)和浏览器),更好的整体性能和大型数组/对象迭代的优化,以及自定义构建和模板预编译实用程序的更大灵活性。)
Because Lo-Dash is updated more frequently than Underscore, a lodash underscore
build is provided to ensure compatibility with the latest stable version of Underscore.
(由于Lo-Dash比lodash underscore
更新频繁, 因此提供了lodash underscore
构建,以确保与最新稳定版本的lodash underscore
兼容。)
At one point I was even given push access to Underscore, in part because Lo-Dash is responsible for raising more than 30 issues;
(有一次,我甚至获得了对Underscore的推动 ,部分原因是Lo-Dash负责筹集超过30个问题;)
landing bug fixes, new features, & perf gains in Underscore v1.4.x+. (Underscore v1.4.x +中的登陆错误修复,新功能和性能提升。)
In addition there are at least 3 Backbone boilerplates that include Lo-Dash by default and Lo-Dash is now mentioned in Backbone's official documentation .
(此外,默认情况下至少有3个Backbone样板包含Lo-Dash,现在Backbone的官方文档中提到了Lo-Dash。)
Check out Kit Cambridge's post, Say "Hello" to Lo-Dash , for a deeper breakdown on the differences between Lo-Dash and Underscore.
(查看Kit Cambridge的帖子, 向Lo-Dash说“你好” ,以便更深入地分析Lo-Dash和Underscore之间的差异。)
Footnotes:
(脚注:)
- Underscore has inconsistent support for arrays, strings, objects, and
arguments
objects. (Underscore对数组,字符串,对象和arguments
对象的支持不一致。)
In newer browsers, Underscore methods ignore holes in arrays , "Objects" methods iterate arguments
objects, strings are treated as array-like, and methods correctly iterate functions (ignoring their "prototype" property) and objects (iterating shadowed properties like "toString" and "valueOf"), while in older browsers they will not. (在较新的浏览器中,Underscore方法忽略数组中的漏洞 ,“Objects”方法迭代arguments
对象,字符串被视为类似数组,方法正确迭代函数(忽略它们的“原型”属性)和对象(迭代阴影属性,如“toString”)和“valueOf”),而在较旧的浏览器中他们不会。)
Also, Underscore methods like _.clone
preserve holes in arrays, while others like _.flatten
don't. (此外,像_.clone
这样的_.clone
方法_.clone
保留数组中的漏洞,而像_.flatten
这样的其他_.flatten
则不会。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…