Loading lib/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ let subtractLists mutuallyExclusive groupBy groupBy'; inherit (self.strings) concatStrings concatMapStrings concatImapStrings intersperse concatStringsSep concatMapStringsSep concatImapStringsSep makeSearchPath makeSearchPathOutput concatImapStringsSep concatLines makeSearchPath makeSearchPathOutput makeLibraryPath makeBinPath optionalString hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape escapeShellArg escapeShellArgs Loading lib/strings.nix +11 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,17 @@ rec { # List of input strings list: concatStringsSep sep (lib.imap1 f list); /* Concatenate a list of strings, adding a newline at the end of each one. Defined as `concatMapStrings (s: s + "\n")`. Type: concatLines :: [string] -> string Example: concatLines [ "foo" "bar" ] => "foo\nbar\n" */ concatLines = concatMapStrings (s: s + "\n"); /* Construct a Unix-style, colon-separated search path consisting of the given `subDir` appended to each of the given paths. Loading lib/tests/misc.nix +5 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,11 @@ runTests { expected = "a,b,c"; }; testConcatLines = { expr = concatLines ["a" "b" "c"]; expected = "a\nb\nc\n"; }; testSplitStringsSimple = { expr = strings.splitString "." "a.b.c.d"; expected = [ "a" "b" "c" "d" ]; Loading Loading
lib/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ let subtractLists mutuallyExclusive groupBy groupBy'; inherit (self.strings) concatStrings concatMapStrings concatImapStrings intersperse concatStringsSep concatMapStringsSep concatImapStringsSep makeSearchPath makeSearchPathOutput concatImapStringsSep concatLines makeSearchPath makeSearchPathOutput makeLibraryPath makeBinPath optionalString hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape escapeShellArg escapeShellArgs Loading
lib/strings.nix +11 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,17 @@ rec { # List of input strings list: concatStringsSep sep (lib.imap1 f list); /* Concatenate a list of strings, adding a newline at the end of each one. Defined as `concatMapStrings (s: s + "\n")`. Type: concatLines :: [string] -> string Example: concatLines [ "foo" "bar" ] => "foo\nbar\n" */ concatLines = concatMapStrings (s: s + "\n"); /* Construct a Unix-style, colon-separated search path consisting of the given `subDir` appended to each of the given paths. Loading
lib/tests/misc.nix +5 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,11 @@ runTests { expected = "a,b,c"; }; testConcatLines = { expr = concatLines ["a" "b" "c"]; expected = "a\nb\nc\n"; }; testSplitStringsSimple = { expr = strings.splitString "." "a.b.c.d"; expected = [ "a" "b" "c" "d" ]; Loading