summaryrefslogtreecommitdiffstats
path: root/lib/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-06-18 15:36:18 +0200
committertv <tv@krebsco.de>2017-06-18 15:49:54 +0200
commit9f75e81c5f91aa4236f86c29437de190503ad586 (patch)
tree44030457fe5589d2b7e090528d0e56cee88b5fa7 /lib/default.nix
parentce89fd63d5d3ed3dc701b11a79d392294d35bd76 (diff)
lib: add test and testString
Diffstat (limited to 'lib/default.nix')
-rw-r--r--lib/default.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 9399a010..803a614a 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -29,6 +29,10 @@ let
setAttr = name: value: set: set // { ${name} = value; };
+ test = re: x: isString x && testString re x;
+
+ testString = re: x: match re x != null;
+
toC = x: let
type = typeOf x;
reject = throw "cannot convert ${type}";