From d5cacb040101422e2c24b39e9c56b89e7271676c Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Tue, 18 Jun 2024 17:48:37 +1200 Subject: [PATCH] initial: re-vendor @ c00e0fa c00e0fa avoid converting objects twice baafe10 fix doc comment --- initial.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/initial.d b/initial.d index 7f4a585..289c33c 100644 --- a/initial.d +++ b/initial.d @@ -218,7 +218,7 @@ struct INISection keys = new string[string]; } - /+ + /++ + Returns the value of `k` in this section or + `defaultValue` if the key is not present. +/ @@ -234,10 +234,10 @@ struct INISection + with a message containing location information. +/ T - keyAs(T)(string k, string defaultValue = null) + keyAs(T)(string k, T defaultValue) { try - return key(k, defaultValue).to!T(); + return k in keys ? keys[k].to!T() : defaultValue; catch (ConvException) throw new INITypeException( format!"unable to convert [%s].%s to %s"(name, k, T.stringof));