Socket
Socket
Sign inDemoInstall

@lumino/algorithm

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lumino/algorithm

Lumino Algorithms and Iterators


Version published
Weekly downloads
133K
increased by13.65%
Maintainers
6
Weekly downloads
 
Created

What is @lumino/algorithm?

@lumino/algorithm is a collection of generic algorithms and data structures for JavaScript. It provides a variety of utilities for working with iterables, sequences, and other common algorithmic tasks.

What are @lumino/algorithm's main functionalities?

Iterating over sequences

The `each` function allows you to iterate over a sequence and apply a function to each element.

const { each } = require('@lumino/algorithm');

const array = [1, 2, 3, 4, 5];
each(array, value => {
  console.log(value);
});

Filtering sequences

The `filter` function creates a new sequence containing only the elements that satisfy a given predicate.

const { filter } = require('@lumino/algorithm');

const array = [1, 2, 3, 4, 5];
const evenNumbers = filter(array, value => value % 2 === 0);
console.log([...evenNumbers]);

Reducing sequences

The `reduce` function reduces a sequence to a single value by applying an accumulator function.

const { reduce } = require('@lumino/algorithm');

const array = [1, 2, 3, 4, 5];
const sum = reduce(array, (acc, value) => acc + value, 0);
console.log(sum);

Mapping sequences

The `map` function creates a new sequence with the results of applying a function to every element in the original sequence.

const { map } = require('@lumino/algorithm');

const array = [1, 2, 3, 4, 5];
const squares = map(array, value => value * value);
console.log([...squares]);

Other packages similar to @lumino/algorithm

FAQs

Package last updated on 15 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc