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

wonka

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wonka - npm Package Compare versions

Comparing version 6.2.3 to 6.2.4

7

CHANGELOG.md
# wonka
## 6.2.4
### Patch Changes
- Add missing overload definition for `filter`, which allows types to be narrowed, e.g. by specifying a type predicate return type
Submitted by [@kitten](https://github.com/kitten) (See [#149](https://github.com/0no-co/wonka/pull/149))
## 6.2.3

@@ -4,0 +11,0 @@

2

dist/wonka.d.ts

@@ -525,3 +525,5 @@ /**

*/
declare function filter<In, Out extends In>(predicate: (value: In) => value is Out): Operator<In, Out>;
declare function filter<T>(predicate: (value: T) => boolean): Operator<T, T>;
/** Maps emitted values using the passed mapping function.

@@ -528,0 +530,0 @@ *

11

package.json
{
"name": "wonka",
"description": "A tiny but capable push & pull stream library for TypeScript and Flow",
"version": "6.2.3",
"version": "6.2.4",
"author": "0no.co <hi@0no.co>",

@@ -64,4 +64,4 @@ "source": "./src/index.ts",

"devDependencies": {
"@changesets/cli": "^2.25.2",
"@changesets/get-github-info": "^0.5.1",
"@changesets/cli": "^2.26.0",
"@changesets/get-github-info": "0.5.0",
"@rollup/plugin-buble": "^1.0.1",

@@ -79,2 +79,3 @@ "@rollup/plugin-commonjs": "^23.0.3",

"callbag-take": "^1.5.0",
"dotenv": "^16.0.3",
"eslint": "^8.29.0",

@@ -104,4 +105,6 @@ "eslint-config-prettier": "^8.5.0",

"build": "rollup -c scripts/rollup.config.mjs",
"clean": "rimraf dist node_modules/.cache"
"clean": "rimraf dist node_modules/.cache",
"changeset:version": "changeset version && pnpm install --lockfile-only",
"changeset:publish": "changeset publish"
}
}

@@ -234,6 +234,8 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';

it('prevents emissions for which a predicate fails', () => {
const { source, next } = sources.makeSubject();
const { source, next } = sources.makeSubject<boolean>();
const fn = vi.fn();
sinks.forEach(fn)(operators.filter(x => !!x)(source));
sinks.forEach((x: true) => {
fn(x);
})(operators.filter((x): x is true => !!x)(source));

@@ -240,0 +242,0 @@ next(false);

@@ -1,2 +0,2 @@

import { Source, Sink, Operator, SignalKind, TalkbackKind, TalkbackFn } from './types';
import { Push, Source, Sink, Operator, SignalKind, TalkbackKind, TalkbackFn } from './types';
import { push, start, talkbackPlaceholder } from './helpers';

@@ -271,3 +271,5 @@ import { fromArray } from './sources';

*/
export function filter<T>(predicate: (value: T) => boolean): Operator<T, T> {
function filter<In, Out extends In>(predicate: (value: In) => value is Out): Operator<In, Out>;
function filter<T>(predicate: (value: T) => boolean): Operator<T, T>;
function filter<In, Out>(predicate: (value: In) => boolean): Operator<In, Out> {
return source => sink => {

@@ -284,3 +286,3 @@ let talkback = talkbackPlaceholder;

} else {
sink(signal);
sink(signal as Push<any>);
}

@@ -291,2 +293,4 @@ });

export { filter };
/** Maps emitted values using the passed mapping function.

@@ -293,0 +297,0 @@ *

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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