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
commit11a16797df89862be7dff81b6af5cd5bf41b580c (patch)
treea39844f33876126ae3d93be28e5a4cb7c07d200e /lib/default.nix
parentf48808dda4911af60bc0cc32c00d6544f6e713b9 (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 9399a01..803a614 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}";