Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hyperjump/pact

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperjump/pact - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

36

lib/index.d.ts

@@ -72,2 +72,14 @@ export const map: (

export const dropWhile: (
<A>(fn: Predicate<A>, iterator: Iterable<A>) => Generator<A>
) & (
<A>(fn: Predicate<A>) => (iterator: Iterable<A>) => Generator<A>
);
export const asyncDropWhile: (
<A>(fn: AsyncPredicate<A>, iterator: AsyncIterable<A>) => AsyncGenerator<A>
) & (
<A>(fn: AsyncPredicate<A>) => (iterator: AsyncIterable<A>) => AsyncGenerator<A>
);
export const take: (

@@ -85,2 +97,14 @@ <A>(count: number, iterator: Iterable<A>) => Generator<A>

export const takeWhile: (
<A>(fn: Predicate<A>, iterator: Iterable<A>) => Generator<A>
) & (
<A>(fn: Predicate<A>) => (iterator: Iterable<A>) => Generator<A>
);
export const asyncTakeWhile: (
<A>(fn: AsyncPredicate<A>, iterator: AsyncIterable<A>) => AsyncGenerator<A>
) & (
<A>(fn: AsyncPredicate<A>) => (iterator: AsyncIterable<A>) => AsyncGenerator<A>
);
export const head: <A>(iterator: Iterable<A>) => A | undefined;

@@ -138,2 +162,14 @@ export const asyncHead: <A>(iterator: AsyncIterable<A>) => Promise<A | undefined>;

export const find: (
<A>(fn: Predicate<A>, iterator: Iterable<A>) => A
) & (
<A>(fn: Predicate<A>) => (iterator: Iterable<A>) => A
);
export const asyncFind: (
<A>(fn: AsyncPredicate<A>, iterator: Iterable<A> | AsyncIterable<A>) => Promise<A>
) & (
<A>(fn: AsyncPredicate<A>) => (iterator: Iterable<A> | AsyncIterable<A>) => Promise<A>
);
export const count: <A>(iterator: Iterable<A>) => number;

@@ -140,0 +176,0 @@ export const asyncCount: <A>(iterator: AsyncIterable<A>) => Promise<number>;

@@ -98,2 +98,32 @@ import curry from "just-curry-it";

export const dropWhile = curry(function* (fn, iter) {
let dropping = true;
for (const n of iter) {
if (dropping) {
if (fn(n)) {
continue;
} else {
dropping = false;
}
}
yield n;
}
});
export const asyncDropWhile = curry(async function* (fn, iter) {
let dropping = true;
for await (const n of iter) {
if (dropping) {
if (await fn(n)) {
continue;
} else {
dropping = false;
}
}
yield n;
}
});
export const take = curry(function* (count, iter) {

@@ -117,2 +147,22 @@ const iterator = getIterator(iter);

export const takeWhile = curry(function* (fn, iter) {
for (const n of iter) {
if (fn(n)) {
yield n;
} else {
break;
}
}
});
export const asyncTakeWhile = curry(async function* (fn, iter) {
for await (const n of iter) {
if (await fn(n)) {
yield n;
} else {
break;
}
}
});
export const head = (iter) => {

@@ -222,2 +272,18 @@ const iterator = getIterator(iter);

export const find = curry((fn, iter) => {
for (const item of iter) {
if (fn(item)) {
return item;
}
}
});
export const asyncFind = curry(async (fn, iter) => {
for await (const item of iter) {
if (await fn(item)) {
return item;
}
}
});
export const count = (iter) => reduce((count) => count + 1, 0, iter);

@@ -224,0 +290,0 @@ export const asyncCount = (iter) => asyncReduce((count) => count + 1, 0, iter);

2

package.json
{
"name": "@hyperjump/pact",
"version": "1.2.0",
"version": "1.3.0",
"description": "Higher order functions for iterators and async iterators",

@@ -5,0 +5,0 @@ "type": "module",

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