Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1 to 0.1.2

17

index.js

@@ -56,2 +56,14 @@ function addSymbolIterator(obj) {

function isIterator(data) {
try {
return (
Symbol.iterator in data &&
typeof data.next === "function" &&
data.propertyIsEnumerable("next") === false
);
} catch {
return false;
}
}
function getIterator(data) {

@@ -75,3 +87,5 @@ const iter = data["@@iterator"];

function getOrCreateIterator(data) {
if (hasSymbolIterator(data)) {
if (isIterator(data)) {
return data;
} else if (hasSymbolIterator(data)) {
return data[Symbol.iterator]();

@@ -93,2 +107,3 @@ } else if (hasNext(data)) {

addSymbolIteratorFallback,
isIterator,
isArray,

@@ -95,0 +110,0 @@ hasNext,

2

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

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

@@ -19,2 +19,5 @@ # iter-fun

import { isIterator } from "iter-fun";
isIterator([1, 2, 3][Symbol.iterator]()); // true
import { hasNext } from "iter-fun";

@@ -21,0 +24,0 @@ hasNext({ next: () => {...} }); // true

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