summary refs log tree commit diff
path: root/lib/strings.nix
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-08-10 20:06:28 +0200
committerDomen Kožar <domen@dev.si>2016-08-10 20:06:52 +0200
commit221f7f18c150f92e6772c0b912c56692e1da519e (patch)
tree834eaa83c2566d003276b0dbaced72b6e3978f05 /lib/strings.nix
parenta4161ac355636551f5a3a441d388c7c0021b80f7 (diff)
downloadnixlib-221f7f18c150f92e6772c0b912c56692e1da519e.tar
nixlib-221f7f18c150f92e6772c0b912c56692e1da519e.tar.gz
nixlib-221f7f18c150f92e6772c0b912c56692e1da519e.tar.bz2
nixlib-221f7f18c150f92e6772c0b912c56692e1da519e.tar.lz
nixlib-221f7f18c150f92e6772c0b912c56692e1da519e.tar.xz
nixlib-221f7f18c150f92e6772c0b912c56692e1da519e.tar.zst
nixlib-221f7f18c150f92e6772c0b912c56692e1da519e.zip
hasSuffix: human readable inputs
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index daf845839343..112165df82ab 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -156,12 +156,12 @@ rec {
        hasSuffix "foo" "barfoo"
        => true
   */
-  hasSuffix = suff: str:
+  hasSuffix = suffix: content:
     let
-      lenStr = stringLength str;
-      lenSuff = stringLength suff;
-    in lenStr >= lenSuff &&
-       substring (lenStr - lenSuff) lenStr str == suff;
+      lenContent = stringLength content;
+      lenSuffix = stringLength suffix;
+    in lenContent >= lenSuffix &&
+       substring (lenContent - lenSuffix) lenContent content == suffix;
 
   /* Convert a string to a list of characters (i.e. singleton strings).
      This allows you to, e.g., map a function over each character.  However,