Explorer

std.bytes-to-base64-groups

description
The Base64 of count groups of 3 bytes from index. Splits the range in half so that the recursion stays shallow for long byte lists
type
Fn(bytes: List<Number>, index: Number, count: Number) -> String
expression
fn(bytes$0, index$1, count$2) =>
  match @core.less-than(left: $2, right: 2) {
    true =>
      match @core.less-than(left: $2, right: 1) {
        true =>
          "",
        false =>
          @std.bytes-to-base64-group(bytes: $0, index: $1)
      },
    false =>
      let half$3 = @core.divide(left: $2, right: 2);
      @core.string-concat(
        left: @std.bytes-to-base64-groups(bytes: $0, index: $1, count: $3),
        right: @std.bytes-to-base64-groups(
          bytes: $0,
          index: @core.plus(left: $1, right: @core.multiply(left: $3, right: 3)),
          count: @core.minus(left: $2, right: $3)
        )
      )
  }
visibility
public
std.bytes-to-base64-groups (project definy, branch commit-check, snapshot Jh11inSnBH1eenK5G-juhyzQabT1OLdy3NmjD6OiVCs)
id: pfltsfxi1QlPKtFb5CR0-uvkUv--T_PukrPFgPmj-AM
content hash: gCQvjCMBFx-zhJXajzujr2wJMoEvvdnwMLObhkSoY18