JavaScript Iterator Class

后端 未结 7 1311
挽巷
挽巷 2020-12-29 07:55

Do you know a JavaScript library that implements a generic Iterator class for collections (be it Arrays or some abstract Enumerable) with a full set of features, like the Go

相关标签:
7条回答
  • 2020-12-29 08:24

    Ive used LINQ to Javascript in a few projects.

    http://jslinq.codeplex.com/Wikipage

    var myList = [
                {FirstName:"Chris",LastName:"Pearson"},
                {FirstName:"Kate",LastName:"Johnson"},
                {FirstName:"Josh",LastName:"Sutherland"},
                {FirstName:"John",LastName:"Ronald"},
                {FirstName:"Steve",LastName:"Pinkerton"}
                ];
    
    var exampleArray = JSLINQ(myList)
                       .Where(function(item){ return item.FirstName == "Chris"; })
                       .OrderBy(function(item) { return item.FirstName; })
                       .Select(function(item){ return item.FirstName; });
    
    0 讨论(0)
提交回复
热议问题