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

prague

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prague - npm Package Compare versions

Comparing version 0.22.3 to 0.22.4

3

lib/src/pipe.d.ts

@@ -13,3 +13,4 @@ import { Result, Transform, Norm, Action, ResultClass, Output, NullIfNullable } from "./prague";

export declare const transformNull: <R>(transform: () => R) => Transform<[Output], Result | (import("./core").BaseType<R> extends null | undefined ? null : import("./core").BaseType<R> extends Result ? import("./core").BaseType<R> : import("./core").BaseType<R> extends () => any ? Action : import("./core").Value<import("./core").BaseType<R>>)>;
export declare const run: Transform<[Result], Result>;
export declare const doAction: Transform<[Result], Result>;
export declare function run<ARGS extends any[], O>(transform: (...args: ARGS) => O): Transform<ARGS, Result | NullIfNullable<import("./core").BaseType<O> extends null | undefined ? null : import("./core").BaseType<O> extends Result ? import("./core").BaseType<O> : import("./core").BaseType<O> extends () => any ? Action : import("./core").Value<import("./core").BaseType<O>>>>;
export declare function combine(): Transform<[], null>;

@@ -16,0 +17,0 @@ export declare function combine<ARGS extends any[], R0>(...args: [(...args: ARGS) => R0]): Transform<ARGS, Norm<R0>>;

@@ -19,3 +19,7 @@ "use strict";

exports.transformNull = (transform) => prague_1.from((o) => o || transform());
exports.run = exports.tap(exports.transformResult(prague_1.Action, action => action.action()));
exports.doAction = exports.tap(exports.transformResult(prague_1.Action, action => action.action()));
function run(transform) {
return pipe(transform, exports.doAction);
}
exports.run = run;
function combine(...transforms) {

@@ -22,0 +26,0 @@ if (transforms.length === 0)

{
"name": "prague",
"version": "0.22.3",
"version": "0.22.4",
"description": "EDSL for rules",

@@ -5,0 +5,0 @@ "main": "lib/src/prague.js",

@@ -1,10 +0,1 @@

# Ideas
## Spell out "magic" functions:
arg => first(...)(arg)
## Do "simple" Prague:
# *Prague*

@@ -186,3 +177,3 @@

#### `Action` and `run`
#### `Action`, `doAction`, and `run`

@@ -228,3 +219,3 @@ Imagine we're creating a chatbot that can respond to several phrases:

This is common enough that *Prague* provides a helper called `run`:
*Prague* provides a helper called `doAction` for this specific *tap*:

@@ -234,6 +225,12 @@ ```ts

bot,
run,
doAction,
)("Wassup").subscribe(); // WAAAASSSUUUUUUP
```
and a helper called `run` for this very common pattern:
```ts
run(bot)("Wassup").subscribe(); // WAAAASSSUUUUUUP
```
Obviously actions can do much more than `console.log`. This approach of waiting to executing side effects until you're done is a classic functional programming pattern, and makes for much more declarative code.

@@ -240,0 +237,0 @@

@@ -54,5 +54,5 @@ class Result {

if (o === null)
return onNull ? from(onNull)() : null;
return onNull ? onNull() : null;
if (o instanceof Value)
return from(onValue)(o.value);
return onValue(o.value);
throw "expecting Value or null";

@@ -59,0 +59,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