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

literable

v1.0.0

Published

A library for work with iterators inspired in .Net LINQ

Readme

Literable

A library for work with iterators inspired in .Net LINQ

Install

npm install literable

Quick examples

const Literable = require('literable');

const natural = new Literable(function*() {
    let current = 1;
    while (true) yield current++;
});

const pairsSum = natural.take(1000)
    .where(num => num % 2)
    .sum();

console.log(`The sum of all pair natural numbers below 1001 is ${pairsSum}`);
// The sum of all pair natural numbers below 1001 is 250000

Api

  • aggregate: Applies an accumulator function over a sequence.
  • all: Determines whether all elements of a sequence satisfy a condition.
  • any: Determines whether any element of a sequence exists or satisfies a condition.
  • append: Appends values to the end of the sequence.
  • average: Computes the average of a sequence of numeric values.
  • concat: Concatenates the sequences.
  • contains: Determines whether a sequence contains a specified element.
  • count: Returns the number of elements in a sequence.
  • defaultIfEmpty: Returns the elements of a sequence, or a default value if the sequence is empty.
  • distinct: Returns distinct elements from a sequence.
  • elementAt: Returns the element at a specified index in a sequence.
  • elementAtOrDefault: Returns the element at a specified index in a sequence or a default value if the index is out of range.
  • except: Produces the set difference of two sequences.
  • findIndex: Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the first occurrence within the sequence or a portion of it. This method returns -1 if an item that matches the conditions is not found.
  • findLastIndex: Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the last occurrence within the sequence or a portion of it.
  • first: Returns the first element of a sequence.
  • firstOrDefault: Returns the first element of a sequence, or a default value if no element is found.
  • flat: Projects each element of a sequence to a sequence and all sub-sequence elements concatenated into it recursively and flattens the resulting sequences into one sequence.
  • forEach: Performs the specified action on each element of the sequence.
  • groupBy: Groups the elements of a sequence.
  • groupJoin: Correlates the elements of two sequences based on key equality, and groups the results.
  • indexOf: Searches for the specified element and returns the index of its first occurrence in a sequence or in a range of elements in the sequence.
  • intersect: Produces the set intersection of two sequences.
  • join: Correlates the elements of two sequences based on matching keys.
  • last: Returns the last element of a sequence.
  • lastIndexOf: Returns the index of the last occurrence of a value in a sequence or in a portion of the sequence.
  • lastOrDefault: Returns the last element of a sequence, or a default value if no element is found.
  • max: Returns the maximum value in a sequence of values.
  • maxElement: Returns the maximum value in a sequence of values.
  • min: Returns the minimum value in a sequence of values.
  • minElement: Returns the minimum value in a sequence of values.
  • ofType: Filters the elements of an sequence based on a specified type.
  • orderBy: Sorts the elements of a sequence in ascending order.
  • orderByDescending: Sorts the elements of a sequence in descending order.
  • prepend: Adds values to the beginning of the sequence.
  • reverse: Inverts the order of the elements in a sequence.
  • select: Projects each element of a sequence into a new form.
  • selectMany: Projects each element of a sequence to a sequence and flattens the resulting sequences into one sequence.
  • sequenceEqual: Determines whether two sequences are equal according to an equality comparer.
  • single: Returns a single, specific element of a sequence.
  • singleOrDefault: Returns a single, specific element of a sequence, or a default value if that element is not found.
  • skip: Bypasses a specified number of elements in a sequence and then returns the remaining elements.
  • skipLast: Bypasses a specified number of elements in the end of a sequence and then returns the remaining elements.
  • skipWhile: Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
  • sum: Computes the sum of a sequence of numeric values.
  • take: Returns a specified number of contiguous elements from the start of a sequence.
  • takeLast: Returns a specified number of contiguous elements from the end of a sequence.
  • take-while: Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.
  • thenBy: Performs a subsequent ordering of the elements in a sequence in ascending order.
  • thenByDescending: Performs a subsequent ordering of the elements in a sequence in descending order.
  • toArray: Creates an array from a sequence.
  • traverseBreadthFirst: Traverse over elements exploring all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level.
  • traverseDepthFirst: Traverse over elements exploring as far as possible along each branch before backtracking.
  • union: Produces the set union of two sequences.
  • where: Filters a sequence of values based on a predicate.
  • zip: Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.