npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ex-js-linq

v2.1.0

Published

Linq framework for node js programming language

Downloads

2

Readme

npm version

ex-js-linq

helpful libraries for JavaScript programming

Features

Using npm

npm install ex-js-linq

Overview

var linq = require("ex-js-linq");
var sampleData = [ 
    { id: 3, name: "julia", age: 22, city: "izmir", cars: ["Fiat"] }, 
    { id: 2, name: "Marry", age: 25, city: "istanbul", cars: ["Ford"] }, 
    { id: 4, name: "julia", age: 22, city: "izmir", cars: ["Fiat"] }, 
    { id: 1, name: "John", age: 30, city: "istanbul", cars: ["Ford", "BMW", "Fiat"] }, 
    { id: 5, name: "Furkan", age: 22, city: "istanbul", cars: [] } 
];

.forEach

    new linq(sampleData).forEach(function(x){
        console.log(x);
    });

.select

    var result= new linq(sampleData)
        .select(function(x){return x.age})
        .toArray();
    // or
    var result=new linq(sampleData)
        .select(function(x){
            return {
                name:x.name,
                age:x.age
            }
        }).toArray();

.selectMany

    var result= new linq(sampleData)
        .selectMany(function(x){return x.cars})
        .toArray();
    // result => ["Fiat","Ford","Fiat",...]

.where

    var result=new linq(sampleData)
        .where(function(x){return x.age>23;})
        .toArray();

.firstOrDefault

    var result=new linq(sampleData)
        .firstOrDefault(function(x){return x.id==5;});
    // or
    var result=new linq(sampleData)
        .firstOrDefault();     

.indexOf

    var index=new linq(sampleData)
        .indexOf(function(x){return x.id==5;}); 

.groupBy

    var result=new linq(sampleData)
        .groupBy(function(x){return x.city;})
        .selectMany(function(x){
            return x.items
        }).toArray();
    // result =>[item1,item2,item3,...]
    // or
    var result=new linq(sampleData)
        .groupBy(function(x){return x.city;})
        .toArray();
    // result => [{key:"istanbul",items:[item1,item2,...]},{key:"izmir",items:[item1,item2,...]}]

.any

    var result=new linq(sampleData)
        .any(function(x){return x.id==5;}); 
    // result => true

.exists

    var result=new linq(sampleData)
        .exists(function(x){return x.id==5;}); 
    // result => true

.sum

    var result=new linq(sampleData)
        .sum(function(x){return x.age;}); 
    // or
    var result=new linq([1,2,3]).sum();
    // result => 6

.avg

    var result=new linq(sampleData)
        .avg(function(x){return x.age;}); 
    // or
    var result=new linq([1,2,3]).sum();
    // result => 2

.min

    var result=new linq(sampleData)
        .min(function(x){return x.age;}); 
    // result => 22
    // or
    var result=new linq([1,2,3]).sum();
    // result => 1

.max

    var result=new linq(sampleData)
        .min(function(x){return x.age;}); 
    // result => 30
    // or
    var result=new linq([1,2,3]).sum();
    // result => 3

.remove

    var result=new linq(sampleData)
        .remove(function(x){return x.age==22;})
        .toArray(); 

.take

    var result=new linq(sampleData)
        .take(5).toArray(); 

.skip

    var result=new linq(sampleData)
        .skip(1).take(3).toArray(); 

.orderBy

    var result=new linq(sampleData)
        .orderBy(function(x){ return x.age})
        .toArray();

.orderByDescending

    var result=new linq(sampleData)
        .orderByDescending(function(x){ return x.age})
        .toArray();

.toArray

    var result=new linq(sampleData).toArray();

.distinct

    var result=new linq(sampleData).distinct().toArray();
    // or
    var result=new linq(sampleData).distinct(function(x){ return x.id;}).toArray();

.add

    var item={};
    new linq(sampleData).add(item);

.addRange

    var items=[];
    new linq(sampleData).add(items);

.join

    var items=[];
    var result=new linq(sampleData).join(items).toArray();

.count

    var count=new linq(sampleData).count();
    // or
    var count=new linq(sampleData).count(function(x){ return x.cars.lenght>2;});