in src/PSDocs/Common/ExpressionHelpers.cs [172:192]
internal static bool TryBool(object o, bool convert, out bool value)
{
o = GetBaseObject(o);
if (o is bool bvalue)
{
value = bvalue;
return true;
}
else if (o is JToken token && token.Type == JTokenType.Boolean)
{
value = token.Value<bool>();
return true;
}
else if (convert && TryString(o, out string s) && bool.TryParse(s, out bvalue))
{
value = bvalue;
return true;
}
value = default(bool);
return false;
}