Linq.js is a comprehensive JavaScript implementation of the .NET Language Integrated Query (LINQ) library, offering a fluent API for querying and manipulating data collections. It includes all the original .NET LINQ methods along with several additions, enabling powerful data transformations and filtering across various iterable objects like arrays, Maps, and Sets. The current stable version is 4.0.3, with a release cadence that has provided incremental updates for improved iteration protocol support and enhanced TypeScript definitions. A key differentiator is its transition to a pure ES module structure in version 4.0.0, making it fully compatible with modern JavaScript environments such as Node.js (v14.13.1 and later), TypeScript projects, Deno, and contemporary web browsers. For projects requiring CommonJS modules or targeting older environments, version 3 of the library remains available.
npm install linqVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic LINQ operations including filtering, mapping, and querying iterable objects like Maps, highlighting its fluent API.
For new projects, ensure your Node.js environment is v14.13.1+ and your `package.json` includes `'type': 'module'`. For existing CommonJS projects, continue using `npm install linq@3`.
Add `'type': 'module'` to your `package.json` file to enable ES module resolution. Alternatively, rename your `.js` files to `.mjs` or use `linq@3` for CommonJS.
Configure your `tsconfig.json` with `{'compilerOptions': {'target': 'ES2020', 'moduleResolution': 'node'}}` to ensure types are correctly resolved and compiled.Avoid using `Enumerable.Utils.extendTo` to modify built-in prototypes. Prefer direct instantiation with `Enumerable.from()` or method chaining on `Enumerable` directly to avoid global object mutation.
Add `'type': 'module'` to your `package.json` or switch to `linq@3` and use `const Enumerable = require('linq')`.For `linq@4+`, use `import Enumerable from 'linq'` in an ES module project. For CommonJS, use `linq@3` and `const Enumerable = require('linq')`.Do not attempt to instantiate `Enumerable` with `new`. Call its static methods directly, e.g., `Enumerable.range(1, 10)` or `Enumerable.from(myArray)`.
Import `Enumerable` as a default import and then use `Enumerable.IEnumerable<T>` for type annotation: `import Enumerable from 'linq'; type MyType = Enumerable.IEnumerable<string>;`. Ensure `tsconfig.json` includes `{'compilerOptions': {'target': 'ES2020', 'moduleResolution': 'node'}}`.No dependency data recorded yet.