Tags

 

jLinq is a 100% JavaScript library that allows you to perform complex queries on arrays of JSON data. Instead of using for loops and if statements, you can write fluent queries to filter, sort and select the information you need.

 

What is jLINQ?

LINQ style functionality for Javascript. Allows you to work with sets of data using query style syntax to select, order and sort records.

 

The code is especially useful if you have medium sized sets of information that could be sorted or searched, but you don’t want to have to use a server side call to resort your records.

So what does it look like?

If you’ve ever used LINQ before you’ll be familiar with the syntax. The code below is a simple way to select records from an array in Javascript.

 

//Some sample data
var records = [
  {name:"John", age:25, admin:true},
  {name:"Mike", age:35, admin:false},
  {name:"Randal", age:41, admin:false},
  {name:"Stephanie", age:32, admin:true}
  ];

 

//And a sample query using jLINQ
var results = jLinq.from(records)
  .ignoreCase()
  .startsWith("name", "m")
  .or("j")
  .is("admin")
  .orderBy("age")
  .select();
}}

 

jLINQ simplifies working with arrays of information by providing simple commands to make selections.

Other Resources

 

 

 

 

Advertisements