Commit Graph

6 Commits

Author SHA1 Message Date
TechSY730 3154dbbc41 Add types.is_set() to test whether an arbitrary object is a set as defined by new_sets.bzl. (#181)
* Add sets.is_set() to test whether an arbitrary object is a set.

Since using sets requires special API, it can be useful to determine
whether an object is a set so special handling can be used.
For example, if a method wants to be able to take a list or a set.
2019-09-17 10:21:44 -04:00
Tony Allevato 6741f73322 Add `types.is_depset`. (#105) 2019-02-08 18:37:26 +01:00
Thomas Van Lenten 6ad5e286cb Cache the types to avoid fetching it every time. (#64)
Along the lines of the caching done in #62
2018-11-13 00:03:11 +01:00
Thomas Van Lenten 3b6bba355c Fix up skylint issues. 2018-06-13 11:59:47 -04:00
Thomas Van Lenten e5203c0f5d Reformat .bzl files with buildifier and add format check.
Buildifier 0.12.0 includes initial support for reformatting .bzl files.
- Reformat all the bzl files.
- Expand the travis check to check the .bzl files also.
2018-06-13 10:58:35 -04:00
Taras Tsugrii b09d5d41b2 Add type checking functions.
Even though it's not great to use type checks, they are frequently useful for
checking input types of macros.

Because there is no standard way of checking types, at least 2 types of checks
are used:
- `type(foo) == type([])`
- `type(foo) == "list"`

The first option is not very readable and the second option seem to be relying
on an Bazel implementation detail. Encapsulating type checks into this library
enables consistent and easy to understand type checking without explicitly
relying on implementation details.
2018-05-09 10:55:40 -07:00