TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Just: A library of dependency-free JS utilities that do just do one thing

96 点作者 arash_milani将近 9 年前

15 条评论

131hn将近 9 年前
Javascript library&#x2F;toolkit modularisation do not goes this way. Mout, async or lodash are using a proper scheme to require(&#x27;just&#x2F;thefuction&#x2F;youneed&#x27;) and it&#x27;s fine (no rollup will ever be needed). Polluting npm with dozen of one-liner is not a good idea (never forget left-pad)<p>* <a href="https:&#x2F;&#x2F;github.com&#x2F;caolan&#x2F;async&#x2F;blob&#x2F;master&#x2F;CHANGELOG.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;caolan&#x2F;async&#x2F;blob&#x2F;master&#x2F;CHANGELOG.md</a><p>* <a href="http:&#x2F;&#x2F;moutjs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;moutjs.com&#x2F;</a>
评论 #12108843 未加载
platz将近 9 年前
&#x2F;&#x2F; Object.map: returns a new object with the predicate applied to each value<p>That is not what a predicate is.
评论 #12107763 未加载
评论 #12145096 未加载
adrusi将近 9 年前
This fails to recognize that the smallness of npm modules is intimately related to the proliferation of dependencies. The idea behind the node module-design paradigm is that packages should be small and many, instead of large and few like (for example) in C++. That makes sense because you only use what you need, but it kind of falls apart because the &quot;small&quot; packages you import carry with them 50 other &quot;small&quot; packages. Also because you lose the shortcut for vetting your dependencies which is to vet the people who wrote them. That&#x27;s a half-assed approach to vetting code you rely on, but the alternative seems to be to do nothing at all.<p>So these modules are small, but anything that uses them is going to contribute to the proliferation of dependencies just as much as ever.
评论 #12108725 未加载
评论 #12107829 未加载
drinchev将近 9 年前
Hmm?<p><pre><code> &#x2F;&#x2F; extend Object.assign({}, { foo: &#x27;bar&#x27; }, { baz: &#x27;qui&#x27; }); &#x2F;&#x2F; pluck [{ a:1, b:1 }, { a:2, b:2 }].map( obj =&gt; obj[&quot;a&quot;] ) &#x2F;&#x2F; filter obj Object.keys(obj).reduce( ( result, key) =&gt; { const value = obj[key]; if ( value &lt; 6 ) { result[key] = value } return value; }, {}) &#x2F;&#x2F; map obj Object.keys(obj).reduce( ( result, key) =&gt; { result[key] = obj[key] + 1; return value; }, {}) &#x2F;&#x2F; template const data = { a:1, b: { c: 1 }, d: 2 }; `some ${data.a}, ${data.b.c}`; &#x2F;&#x2F; unique [1,2,2,3,4,4,5].filter( ( value, index, self ) =&gt; self.indexOf( value ) === index ) &#x2F;&#x2F; last [1,2,3].slice(-1)[0] &#x2F;&#x2F; union [1,2,3,4].concat( [6,7,8,9] ).filter( ( value, index, self ) =&gt; self.indexOf( value ) === index ).sort( ( a,b ) =&gt; a-b )</code></pre>
评论 #12108389 未加载
评论 #12109465 未加载
评论 #12108084 未加载
lexicality将近 9 年前
All of these are available in Lodash, both as one package with no dependencies and a plethora of individual micropackages with very small dependencies.
评论 #12109262 未加载
arash_milani将近 9 年前
Here is the author&#x27;s motivation: &quot;It felt wrong installing half of npm even for basic utilities, so I made JUST, a family of dependency-free modules&quot; [1]<p>1: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;angustweets&#x2F;status&#x2F;754375515159441408" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;angustweets&#x2F;status&#x2F;754375515159441408</a>
评论 #12107703 未加载
评论 #12112356 未加载
nathancahill将近 9 年前
I applaud the concept, but also don&#x27;t have too many qualms about installing lodash&#x27;s single function packages, since they typically only have a couple of requirements and are battle tested.
peeyek将近 9 年前
Only one function as a module, Seriously?<p>There are 10 modules that you need to imports if you are using 10 functions. I think it&#x27;s unnecesary
评论 #12107717 未加载
评论 #12108395 未加载
评论 #12107718 未加载
_RPM将近 9 年前
How did the JavaScript community come to this?
评论 #12109388 未加载
评论 #12109290 未加载
评论 #12109058 未加载
fvargas将近 9 年前
What&#x27;s the purpose of having a module like <i>just-template</i> when ES6 already supports templated strings? The only difference I see based on the example is that instead of using a template string literal, you call a function with an additional <i>data</i> argument.
评论 #12107836 未加载
评论 #12112372 未加载
feiss将近 9 年前
I don&#x27;t get it. Does array-last* has any sense? If someone needs to include a package for last() so the code is more bugproof and stable, I don&#x27;t know what to expect in more complex algorithms..<p>This, like many stuff I see in the javascript world, is overegineering.<p>* <a href="https:&#x2F;&#x2F;github.com&#x2F;angus-c&#x2F;just&#x2F;blob&#x2F;master&#x2F;packages&#x2F;array-last&#x2F;index.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;angus-c&#x2F;just&#x2F;blob&#x2F;master&#x2F;packages&#x2F;array-l...</a>
评论 #12110387 未加载
cloudjacker将近 9 年前
Can&#x27;t wait to put these on my microservice so people can concatenate strings more conveniently in the cloud &#x2F;s
mordae将近 9 年前
JUST MAKE A DATABASE-INDEXED GLOBAL PACKAGE SPACE WITH ON-DEMAND FETCHING BY DEFAULT AND PRE-FETCHING POSSIBLE FOR ALL NEW LANGUAGES ALREADY!
_callcc将近 9 年前
`map` and `filter` should take their functional argument first, then data second.
评论 #12108499 未加载
评论 #12108635 未加载
评论 #12109164 未加载
评论 #12109503 未加载
surunzi将近 9 年前
Publishing a single function as a package... Isn&#x27;t it the reason why npm modules all have so many fucking dependencies?