Git Product home page Git Product logo

brex's People

Contributors

alexocode avatar janpieper avatar ktec avatar lorenzosinisi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

brex's Issues

Conflict of is_struct with Kernel.is_struct

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?

`Brex.none/1` misbehaves when an empty list of rules is given

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? ๐Ÿ˜‰

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.