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 🙏

© 2025 – Pkg Stats / Ryan Hefner

enumerable-ts

v0.0.6-beta

Published

A port of System.Linq.Enumerable from the .NET framework to TypeScript

Downloads

7

Readme

enumerable-ts

A port of System.Linq.Enumerable from the .NET framework to TypeScript, using a unique and safe design pattern which directly exposes the Enumerable class as a collection of polymorphic extension methods to all of the classes defined in the core language specification that implement the iterable protocol.

Why enumerable-ts?

enumerable-ts is designed to fulfill the same purpose as the Enumerable class from C#. It provides a collection of extension methods to the built-in classes and uses deferred execution for declaring complex queries and iterating large collections with efficient memory consumption.

This is possible through the use of generator functions. Generator functions provide a way of expressing deferred execution consumed through the iterator protocol. This allows complex queries to be constructed and iterated without buffering intermediate copies of the entire underlying collection in memory.

Usage

Installing

$ npm i --save enumerable-ts

ES2015

import 'enumerable-ts'

CommonJS

require('enumerable-ts')

Example

const array: object[] = getBigData() // some large array
const query = array.selectMany(Object.entries).take(5)

for (const [key: string, value: any] of query) {
  console.log(key, value)
}

Because of deferred execution, Object.entries() is only evaluated on however many objects required to yield a total of 5 key / value pairs, and isn't evaluated at all until the query is actually iterated by the for...of loop, which calls and consumes query[Symbol.iterator]() to yield its 5 entries.

Documentation

FAQ

Why are concat(), join(), reverse(), and toJSON() only on Enumerable and not on the IEnumerable interface?

In order to remain polymorphic, all the IEnumerable interface methods must be forward-compatible with the methods on all of its implementing classes. Since many of the built-in Iterables in JavaScript already implement these methods with conflicting signatures, it's by design that these methods are only available on instances of the concrete Enumerable class.

However, by using explicit calls to these methods on the Enumerable class like Enumerable.prototype.concat.join(array, …), they can still be directly applied to instances of the built-in classes without violating the principles of polymorphism.

Roadmap

  • [ ] Documentation of usage with example code
  • [x] Full port of core System.Linq.Enumerable methods
  • [ ] Full port of MoreLINQ methods
  • [x] Node.js support
  • [ ] Browser support
  • [ ] Require.js support
  • [ ] Universal Module Definition
  • [ ] Separate exports with and without global-modifying side-effects (similar to colors)

Contributing

Do you have feature requests, bug reports, or ideas for improving this project? Please open new issues on the github repository with details about your inquiry.

License

Copyright © 2018 Patrick Roberts

MIT License