From 9370ea5e3303359a9c25417b0b8210d174e167e5 Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 23 Nov 2021 19:06:09 +0100 Subject: chore(sterni/nix/utf8): remove decodeSafe This is not really used anywhere and kind of useless. A better decodeSafe would never return null and instead make use of replacement characters to represent invalid bytes in the input. Change-Id: Ib4111529bf0e472dbfa720a5d0b939c2d2511de5 --- users/sterni/nix/utf8/default.nix | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/users/sterni/nix/utf8/default.nix b/users/sterni/nix/utf8/default.nix index c4a3e8eb03b3..99947c5a8c2c 100644 --- a/users/sterni/nix/utf8/default.nix +++ b/users/sterni/nix/utf8/default.nix @@ -209,23 +209,9 @@ let ) iterResult ); - /* Decodes an UTF-8 string, but doesn't throw on error. - Instead it returns null. - - Type: string -> ( [ integer ] | null) - */ - decodeSafe = s: - let - res = builtins.tryEval (decode s); - in - if res.success - then res.value - else null; - in { inherit decode - decodeSafe step ; } -- cgit 1.4.1