alexocode / brex Goto Github PK
View Code? Open in Web Editor NEWdefine, compose, and evaluate your business rules in Elixir
License: MIT License
define, compose, and evaluate your business rules in Elixir
License: MIT License
Hello! I was trying to use Brex within an app using:
Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.10.2 (compiled with Erlang/OTP 22)
On MacOS 10.15.4
And I got an error of compilation of Brex because of a conflict on is_struct defined in Brex.Rule.Struct
at line 32
.
I have solved the issue and got the compiler to pass by changing it from is_struct to is_a_struct and changing the function name in that file so that there is no conflict. Do you think that it would make sense to open a PR?
When using Brex.none/1
with a dynamic set of rules, I discovered a behaviour I am unsure if it is the expected one. Check the following example:
Brex.none([])
|> Brex.evaluate(:something)
|> Brex.passed?()
No rules have been passed to Brex.none/1
. I would expect true
, but it currently returns false
.
There is no native implementation of none?
in Elixir, so I use Ruby as reference:
[].all? # true
[].none? # true
The problem with Brex.none/1
and passing an empty list of rules is, that it passes the given rules to Brex.all/1
and inverts the result. I think we need a special handling for the case when Brex.none/1
receives an empty list of rules.
defmodule Brex.Operator.Aggregator do
# ...
def none?([]), do: true
def none?(enum), do: not all?(enum)
end
What do you think? ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.