l**********n 发帖数: 8443 | 1 http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to
module.exports = leftpad;
function leftpad (str, len, ch) {
str = String(str);
var i = -1;
if (!ch && ch !== 0) ch = ' ';
len = len - str.length;
while (++i < len) {
str = ch + str;
}
return str;
} |
s***o 发帖数: 2191 | 2 best comment on reddit:
"well, they are javascript developers" |
l**********n 发帖数: 8443 | 3 I think open source projects are all like that
【在 s***o 的大作中提到】 : best comment on reddit: : "well, they are javascript developers"
|
l**********n 发帖数: 8443 | 4 a good module developer would use as few external modules as possible. also
to make the library as small as possible |
n*****t 发帖数: 22014 | 5 这其实是个经典案例,现在轮子越来越多,人越来越懒。很多所谓马工上班就是 cc-cv
,根本不动脑子,更不考虑什么效率啊稳定性啊之类的。
【在 l**********n 的大作中提到】 : http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to : module.exports = leftpad; : function leftpad (str, len, ch) { : str = String(str); : var i = -1; : if (!ch && ch !== 0) ch = ' '; : len = len - str.length; : while (++i < len) { : str = ch + str; : }
|
n******7 发帖数: 12463 | 6 这个更发指吧
There’s a package called isArray that has 880,000 downloads a day, and 18
million downloads in February of 2016. It has 72 dependent NPM packages.
Here’s it’s entire 1 line of code:
1 return toString.call(arr) == '[object Array]';
我最讨厌没意义的dependence,和过度设计的系统
就是一坨xx |
T*******x 发帖数: 8565 | 7 哈哈。这个太幽默了。
【在 n******7 的大作中提到】 : 这个更发指吧 : There’s a package called isArray that has 880,000 downloads a day, and 18 : million downloads in February of 2016. It has 72 dependent NPM packages. : Here’s it’s entire 1 line of code: : 1 return toString.call(arr) == '[object Array]'; : 我最讨厌没意义的dependence,和过度设计的系统 : 就是一坨xx
|
a*f 发帖数: 1790 | 8 这是以前C编程的思想,我们试过把所有的库函数都实现,二进制文件比源代码还小
现在很多时候更追求convention over configuration。如果一个library只有少数人用
,一般不管,用的人多了就成了convention。比如Java的空字串,开始的项目都自己写
,后来人换多了就统一用StringUtils。jQuery的UI也是这样,很多控件其实很容易写
,特别是Bootstrap也出来后。
also
【在 l**********n 的大作中提到】 : a good module developer would use as few external modules as possible. also : to make the library as small as possible
|
ET 发帖数: 10701 | 9 at least, that's how i develops iOS app.
I check carefully the 3rd library I will use.
but for node.js, I don't really care. i can't tell difference anyways.
also
【在 l**********n 的大作中提到】 : a good module developer would use as few external modules as possible. also : to make the library as small as possible
|
c******n 发帖数: 16666 | 10 js这一点都挺吓人的
我现在bower update都是一个一个来
【在 ET 的大作中提到】 : at least, that's how i develops iOS app. : I check carefully the 3rd library I will use. : but for node.js, I don't really care. i can't tell difference anyways. : : also
|
d*******r 发帖数: 3299 | 11 Node.js 的模块是比较 fragile, 不如 Python 模块,但是 Ruby 的模块更 fragile.
这个主要跟社区的人有关. |