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
This commit is contained in:
sterni 2021-11-23 19:06:09 +01:00
parent a935570a22
commit 9370ea5e33

View file

@ -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
;
}