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

iter-fun

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iter-fun - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

21

index.js

@@ -101,2 +101,20 @@ function addSymbolIterator(obj) {

function zip(iters) {
// convert input to iters just in case
iters = iters.map(getOrCreateIterator);
return wrapNextFunction(function next() {
const values = iters.map(iter => iter.next());
// if they are all done, stop
if (values.every(({ done }) => done)) {
return { done: true };
} else {
return {
done: false,
value: values.map(({ value }) => value)
};
}
});
}
if (typeof module === "object") {

@@ -114,4 +132,5 @@ module.exports = {

getOrCreateIterator,
wrapNextFunction
wrapNextFunction,
zip
};
}

2

package.json
{
"name": "iter-fun",
"version": "0.1.2",
"version": "0.2.0",
"description": "Fun with Iterables",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -57,2 +57,11 @@ # iter-fun

// converts a next function into a fully functioning iterable
import { zip } from "iter-fun";
const zeros = [0, 0, 0, ...];
const twos = [2, 2, 2, ...];
const sixties = [60, 60, 60, ...];
const iters = [zeros, twos, sixties];
const zipped = zip(iters);
zipped.next();
// { done: false, value: [0, 2, 60] }
```
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