[英]How to use streams in JS
I want to manipulate arrays in JS in a similar fashion with Java Streams .我想以与Java Streams类似的方式在 JS 中操作 arrays 。
So所以
arr.map().map().map()
Will do only one iteration.只会做一次迭代。
How can I achieve that without a library?没有图书馆我怎么能做到这一点?
This is similar to LINQ in DotNet.这类似于 DotNet 中的 LINQ。 And there are a lot of library that do that for you already.
并且已经有很多图书馆可以为您做到这一点。
You might want to check out linq.js.您可能想查看 linq.js。 It follows the .NET lambda syntax and looks to be well integrated in a Microsoft environment.
它遵循 .NET lambda 语法,看起来可以很好地集成到 Microsoft 环境中。
LINQ for JavaScript - LINQ 用于 JavaScript -
Pros优点
Cons缺点
Others Similarly Library are:其他类似的库是:
You can also check Rx for Javascript您还可以检查Rx 的 Javascript
For a very nice, complete set of functional list operations, try: http://osteele.com/sources/javascript/functional/对于一个非常好的、完整的功能列表操作集,请尝试: http://osteele.com/sources/javascript/functional/
For more information on how to use just javascript to manipute your list, Please check https://gist.github.com/DanDiplo/30528387da41332ff22b有关如何仅使用 javascript 来操作您的列表的更多信息,请查看https://gist.github.com/DanDiplo/30228
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.