Skip to content

asfez/minilinq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minilinq.js : Lightweight Linq library for javascript.

An extension to javascript array to add some linq functionalities.

Examples:

  • array.where("el=>el.prop=='test'")
  • array.where("el=>el.prop==value","test")
  • array.orderBy("prop")
  • array.orderBy("el=>el.prop")
  • array.orderBy(function(el){return el.prop;})

Functions:

parameters
expression :
- "el=> expression with el,value,index"
- "propertyName" (similar to "el=>el.propertyName")
- function(el,value,index){ ... }
value :
A value represented by "value" in the expression. Used to create more static expeession as
the compiled expressions are cached.
Example array.where("el=>el.prop==value",variable1) instead of array.where("el=>el.prop=="+variable1)

Array.prototype.where = function (expression,value)
Array.prototype.count = function (expression, value)
Array.prototype.orderBy = function (expression, value)
Array.prototype.select = function (expression, value)
Array.prototype.first = function (expression, value)
Array.prototype.last = function (expression, value)
Array.prototype.any = function (expression, value)
Array.prototype.all = function (expression, value)
Array.prototype.skiptake = function (skipcount, takecount, value)
Array.prototype.groupBy = function (expression, value)
Array.prototype.selectMany = function (expression, value)

If not already defined
Array.prototype.forEach = function (fct, scope)

About

A small extension to javascript array to add some basic linq functionalities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published