public static void Unless(TextWriter output, HelperOptions options, dynamic context, params object[] arguments) { if (arguments.Length != 1) { throw new HandlebarsException("{{unless}} helper must have exactly one argument"); } if (HandlebarsUtils.IsFalsy(arguments[0])) { options.Template(output, context); } else { options.Inverse(output, context); } }
public static void With(TextWriter output, object root, HelperOptions options, dynamic context, params object[] arguments) { if (arguments.Length != 1) { throw new HandlebarsException("{{with}} helper must have exactly one argument"); } if (HandlebarsUtils.IsTruthyOrNonEmpty(arguments[0])) { options.Template(output, arguments[0]); } else { options.Inverse(output, context); } }