Socket
Socket
Sign inDemoInstall

lazy-hofs

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lazy-hofs

Bring lazy evaluation of higher order functions to javascript


Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Install size
5.23 kB
Created
Weekly downloads
 

Readme

Source

lazy-hofs

Lazy higher order functions in javascript!

No! It's not what the picture says!

It Brings lazy evaluation to higher order functions in javascript

How to Use

Install the package
npm i lazy-hofs

Add to your project

require("lazy-hofs");

Docs

lazySome()

let arr = [1, 2, 3, 4, 5, 6];
let ref = arr.lazySome((it) => {
  return it === 9;
});
arr.push(9);
let result = ref.lazyEvaluate();
console.log(result);

lazyMap()


let arr = [1, 2, 3, 4, 5, 6];
let ref = arr.lazyMap((it) => {
  return it * 9;
});
arr.push(9);
let result = ref.lazyEvaluate();
console.log(result);

lazyFilter()

let arr = [1, 2, 3, 4, 5, 6];
let ref = arr.lazyFilter((it) => {
  return it % 2 === 0;
});
arr.push(9);
let result = ref.lazyEvaluate();
console.log(result);

lazyReduce()

let arr = [1, 2, 3, 4, 5, 6];
let ref = arr.lazyReduce((it, acc) => {
  return (acc += it);
}, 0);
arr.push(9);
let result = ref.lazyEvaluate();
console.log(result);

Keywords

FAQs

Last updated on 07 Dec 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc