Skip to content

🌀LINQ for TypeScript, now added directly to the Array prototype.

License

Notifications You must be signed in to change notification settings

jlivak/linq-tsglobal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linq for TypeScript, Exported as a Global Modifying Module

Version

This package adds many commonly used .NET Linq methods directly to javascript's Array prototype on import. It does so by making use of Typescript's global modifying module pattern.

It is a fork of the linq.ts project, but moves all of the methods out of a separate List type and into the Array prototype.

Install

$ npm install linq-tsglobal

Usage

Import linq-tsglobal at the top of your entry point file.

import 'linq-tsglobal';

Call linq methods directly on array objects.

let demoArray: string[] = ["Cat", "Dog", "Snake", "Seven"];

demoArray.remove("Seven");
demoArray.removeAt(1);
demoArray.insert(1, "Monkey");
// > ["Cat", "Monkey", "Snake"]

let numbersArray: number[] = [1, 2, 3, 4, 5];

let arr = numbersArray
  .Where(x => x > 3)
  .Select(y => y * 2);
// > [8, 10]

Tests

TODO: Add updated test coverage.

License

Modified linq-tsglobal project distributed under MIT © linq-tsglobal Contributors.

Original linq.ts project distributed under MIT © Flavio Corpa.

About

🌀LINQ for TypeScript, now added directly to the Array prototype.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%