Coder Social home page Coder Social logo

naman03malhotra / match-rules Goto Github PK

View Code? Open in Web Editor NEW
43.0 2.0 6.0 1.27 MB

A tiny 1kB zero dependency JavaScript utility that lets you write your conditional business logic in a declarative way (React like).

Home Page: https://stackblitz.com/edit/match-rules

License: MIT License

JavaScript 100.00%
declarative declarative-programming complex-rules complex-conditions conditional-statements if-else react reactjs npm-module if-else-refactoring

match-rules's Issues

Add more innovative examples in README.md file

Add more examples where this pattern shines from the traditional imperative pattern.

  • Come up with your own interesting examples.
  • Form validations can be messy, maybe a good example around that.
  • You can check your current codebase if you find a messy if-else logic that can be converted to this pattern.
  • One example can be for a dynamic form, where while filling a field will determine the rest of the journey of the form. In that case, you can compose/extend rules on the fly to create a new dynamic rule.

Separate the documentation from Readme file

As we keep adding more examples, we should move the documentation in a docs directory with its separate markdown file.

  • create a new directory docs.
  • create EXAMPLES.md.
  • Move examples in that file.
  • Link those examples in the main README.md file.

Only run tests if there are changes in relevant files.

Presently the test run is triggered even if there is a change outside the source directory. But ideally, it should trigger due to a change in the src directory and other relevant files.

  • Make changes in CI, CD workflow file in .github action directory.
  • Should not run workflows when changes are in readme files etc

Add test case for function's second param.

When a rule has a function value in the key, the value of that key from the source object is passed to the function as the first param and the whole source object as the second param.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.