New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lazily

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazily - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

41

dist/lazily.js

@@ -77,4 +77,4 @@ "use strict";

reduce(fn, initialValue) {
return reduce(this.seq, fn, initialValue);
reduce(fn, initialValue, fnShortCircuit) {
return reduce(this.seq, fn, initialValue, fnShortCircuit);
}

@@ -120,6 +120,8 @@

function every(seq, fn) {
let i = 0;
for (const item of seq()) {
if (!fn(item)) {
if (!fn(item, i, seq)) {
return false;
}
i++;
}

@@ -131,7 +133,9 @@ return true;

return function* () {
let i = 0;
for (const item of seq()) {
if (fn(item)) {
if (fn(item, i, seq)) {
return;
}
yield item;
i++;
}

@@ -143,4 +147,5 @@ };

return function* () {
let i = 0;
for (const item of seq()) {
if (fn(item)) {
if (fn(item, i, seq)) {
yield item;

@@ -150,2 +155,3 @@ return;

yield item;
i++;
}

@@ -156,6 +162,8 @@ };

function find(seq, fn) {
let i = 0;
for (const item of seq()) {
if (fn(item)) {
if (fn(item, i, seq)) {
return item;
}
i++;
}

@@ -166,6 +174,8 @@ }

return function* () {
let i = 0;
for (const item of seq()) {
if (fn(item)) {
if (fn(item, i, seq)) {
yield item;
}
i++;
}

@@ -201,4 +211,6 @@ };

return function* () {
let i = 0;
for (const item of seq()) {
yield fn(item);
yield fn(item, i, seq);
i++;
}

@@ -208,6 +220,11 @@ };

function reduce(seq, fn, initialValue) {
function reduce(seq, fn, initialValue, fnShortCircuit) {
let acc = initialValue;
let i = 0;
for (const item of seq()) {
acc = fn(acc, item);
acc = fn(acc, item, i, seq);
if (fnShortCircuit && fnShortCircuit(acc, item, i, seq)) {
return acc;
}
i++;
}

@@ -242,6 +259,8 @@ return acc;

function some(seq, fn) {
let i = 0;
for (const item of seq()) {
if (fn(item)) {
if (fn(item, i, seq)) {
return true;
}
i++;
}

@@ -248,0 +267,0 @@ return false;

{
"name": "lazily",
"version": "0.0.4",
"version": "0.0.5",
"author": "Jeswin<jeswinpk@agilehead.com>",

@@ -5,0 +5,0 @@ "scripts": {

@@ -71,12 +71,2 @@ # lazily

## exit(predicate) in the middle
```javascript
Seq.of([1, 2, 3, 4, 5])
.map(x => x * 2)
.exit(x => x > 4)
.map(x => x * 10)
.toArray();
// [20, 40]
```
## find(predicate)

@@ -104,3 +94,3 @@ ```javascript

Seq.of([1, 2, 3, 4, 5]).first(x => x > 3);
//
// 4
```

@@ -107,0 +97,0 @@

Sorry, the diff of this file is not supported yet

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