Code Monkey home page Code Monkey logo

multiflag's Introduction

Multiflag
Tests badge Codecov badge

Multiflag is a tiny language-agnostic library that makes manipulating bitflags (or any other kind of flag system) easier, especially if you have flags that depend on each other (for example, if you're managing permissions).

How it works

Multiflag work with two types : flags and flag sets. A flag set can be any value that can represent a group of boolean properties (integers as bitflags, a list of the enabled flags, ...). A flag is one of these properties, and can be dependant on other flags. When a flag is added, all of its parent are too. All its parents are also required for the flag to be considered included in the set. And when it is removed, all of its child flags are removed with it. There is actually a third type coming into play: the "value adapter". Its job is to bridge the gap between a flag and the value it is based on by providing the relevant operation on said type.

Two kind of flags are supported out of the box : a bitflag implementation for integers and enums, and a list-based (or rather, set-based) implementation, which covers most of the common needs. But Multiflag is extensible, you can implement an adapter for any custom type of flag representation you want.

Why ?

This library was developed to provide the Gallium+ server and clients with a reliable way to manage permissions. The primary goal is thus to support C# and Typescipt, but support for other languages (I'm thinking Python, Go, Rust) may come later.

Licensing

Multiglag is available under the MIT License. ⓒ 2023 Louis DEVIE.

multiflag's People

Contributors

louisdevie avatar

Stargazers

 avatar

Watchers

 avatar

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.