dart-lang/boolean_selector

Name: boolean_selector

Owner: Dart

Description: A flexible syntax for boolean expressions.

Created: 2016-02-17 23:30:51.0

Updated: 2017-07-10 17:13:20.0

Pushed: 2018-05-24 19:47:52.0

Homepage: https://pub.dartlang.org/packages/boolean_selector

Size: 28

Language: Dart

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

The boolean_selector package defines a simple and flexible syntax for boolean expressions. It can be used for filtering based on user-defined expressions. For example, the test package uses boolean selectors to allow users to define what platforms their tests support.

The boolean selector syntax is based on a simplified version of Dart's expression syntax. Selectors can contain identifiers, parentheses, and boolean operators, including ||, &&, !, and ? :. Any valid Dart identifier is allowed, and identifiers may also contain hyphens. For example, chrome, chrome || content-shell, and js || (vm && linux) are all valid boolean selectors.

A boolean selector is parsed from a string using new BooleanSelector.parse(), and evaluated against a set of variables using BooleanSelector.evaluate(). The variables may be supplied as a list of strings, or as a function that takes a variable name and returns its value. For example:

rt 'package:boolean_selector/boolean_selector.dart';

 main(List<String> args) {
r selector = new BooleanSelector.parse("(x && y) || z");
int(selector.evaluate((variable) => args.contains(variable)));

Versioning

If this package adds new features to the boolean selector syntax, it will increment its major version number. This ensures that packages that expose the syntax to their users will be able to update their own minor versions, so their users can indicate that they rely on the new syntax.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.