Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
codeimpossible edited this page Nov 8, 2012 · 3 revisions

OqueryJS

A port of linq-to-objects to JavaScript.

OQuery design goals:

  • provide an easy way to query for objects within small to large (50,000 items) javascript arrays
  • support all browsers - internet explorer, chrome, firefox, safari, opera
  • work with module managers - requireJS
  • work with Node.js

So, what is OqueryJS really?

Oquery is a library that wraps a given javascript array and provides easy to use extension methods that allow you to query for objects using a functional programming style.

It turns this:

for(var i = 0; i < users.length; i++ ) {
  var currentUser = users[i];
  if( currentUser.id === id ) {
    foundUser = currentUser;
    break;
  }
}

into this:

var foundUser = $q(users).where( function(user) { 
  return user.id === id;
}).select();

Check out the full documentation for more information.

Clone this wiki locally