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

sequenz-js

v0.2.0

Published

super tiny, lodash-like lazy evaluation library, with cherry-picking!

Downloads

9

Readme

Sequenz

build status Coverage Status

Sequenz.js is a super tiny library that will help you handle arrays, objects, numbers, etc., with lazy engine and cherry-picking!

Motivation

Nowadays, most popular JavaScript utility libraries uses chaining to bundle a group of data transformations. However, as Izaak Schroeder once mentioned (here), it might not be a good design though.

It's true that chaining style makes lazy evaluation easy to implement, but it also causing the size of JavaScript bundle file to be large, as unused APIs are also included. Although Lodash did provide fp package for cherry-picking, lazy evaluation cannot be provided at the same time.

Sequenz.js is designed to have both:

  • A built in lazy engine.

    Transformation of data only requires minimum cost with lightning speed.

  • Designed for cherry-picking

    ES6 module, zero dependencies and no API on prototype.

    Using module bundler with tree-shaking feature (such as Rollup), only required APIs will be imported to your project, making the size of library neglectable.

  • Similar API as those popular libraries, but FP style

    The API provided here is designed to be similar to Lodash, Underscore and Lazy.js, making learning as easy as possible.

Installation

Using npm:

npm install --save sequenz-js

In Node.js:

// Load the full build.
// Bundler should be able to remove unused code later using tree-shaking feature.
const sequenz = require('sequenz-js');

// Manual pick used APIs, if bundler does not support tree-shaking
// You might need to use `.default`, as original code is written in ES6
const map = require('sequenz-js/map').default;
const filter = require('sequenz-js/filter').default;

// Use API
const list = sequenz.list(
  sequenz.map(x => x + 1),
  sequenz.filter(x => x < 4),
  sequenz.take(2)
)([0, 1, 2, 3, 4]);

Benchmark

Current benchmark shows the following result:

Lazy x 38,431 ops/sec ±3.67% (62 runs sampled)

Lodash x 22,486 ops/sec ±2.01% (72 runs sampled)

Sequenz x 21,987 ops/sec ±2.70% (69 runs sampled)

Using [email protected] and [email protected].

Sequenz.js is not the fastest library, as not all optimization can be implemented using pure functions for lazy evaluation, especially when code size is also put into consideration. Still, the benchmark shows that the performance of Sequenz.js and Lodash.js are pretty much the same.