Socket
Socket
Sign inDemoInstall

@open-formulieren/infernologic

Package Overview
Dependencies
0
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @open-formulieren/infernologic

InferNoLogic is the TypeScript library designed to cool down the hellfire of type mismatches in JsonLogic. Navigate through your complex logic rules with the confidence that your types align.


Version published
Maintainers
2
Install size
40.1 kB
Created

Readme

Source

InferNoLogic

Run CI build and tests NPM package code style: prettier

Type checker for JsonLogic expressions with full type inference

Design goal

Infer the result types of JsonLogic expressions and possibly of data referenced in {"var": ...} expressions.

  • without the need of extra annotations; full inference without extra JsonLogic syntax
  • fast; should run in a browser while editing
  • soundness over completeness; prefer false negatives over false positives. For example: in {"if": [predicate-expression, then-expression, else-expression]} require then- and else-expressions of the same type, even though JsonLogic allows them to differing ones.
  • actionable error messages; No "Computer says no" but a location in the expression tree with as narrow a scope as possible, with some helpful humane hint. (Aim for Elm and Rust compiler helpfulness)

Usage

Install with npm or yarn:

npm install --save-dev @open-formulieren/infernologic
yarn add -D @open-formulieren/infernologic

References

Builds on implementations from domdomegg/hindley-milner-typescript-minimal for

  • Algorithm W

    Damas, L. and Milner, R. (1982). Principal type-schemes for functional programs. Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages - POPL '82. https://doi.org/10.1145/582153.582176

  • Algorithm M

    Lee, O. and Yi, K. (1998). Proofs about a folklore let-polymorphic type inference algorithm. ACM Transactions on Programming Languages and Systems, 20(4), 707-723. https://doi.org/10.1145/291891.291892

Keywords

FAQs

Last updated on 27 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc