Explorer

std.bytes-to-base64-group

description
The Base64 of the 3 bytes (fewer at the end) from index
type
Fn(bytes: List<Number>, index: Number) -> String
expression
fn(bytes$0, index$1) =>
  let rest$2 = @core.minus(left: @core.list-length(value: $0), right: $1);
  match @core.less-than(left: $2, right: 1) {
    true =>
      "",
    false =>
      let b0$3 = @std.byte-at-or-zero(bytes: $0, index: @core.plus(left: $1, right: 0));
      let b1$4 = @std.byte-at-or-zero(bytes: $0, index: @core.plus(left: $1, right: 1));
      let b2$5 = @std.byte-at-or-zero(bytes: $0, index: @core.plus(left: $1, right: 2));
      let c0$6 = @std.base64-digit(value: @core.divide(left: $3, right: 4));
      let c1$7 = @std.base64-digit(
          value: @core.plus(
            left: @core.multiply(left: @core.remainder(left: $3, right: 4), right: 16),
            right: @core.divide(left: $4, right: 16)
          )
        );
      let c2$8 = @std.base64-digit(
          value: @core.plus(
            left: @core.multiply(left: @core.remainder(left: $4, right: 16), right: 4),
            right: @core.divide(left: $5, right: 64)
          )
        );
      let c3$9 = @std.base64-digit(value: @core.remainder(left: $5, right: 64));
      match @core.equal(left: $2, right: 1) {
        true =>
          @core.string-concat(left: @core.string-concat(left: $6, right: $7), right: "=="),
        false =>
          match @core.equal(left: $2, right: 2) {
            true =>
              @core.string-concat(left: @core.string-concat(left: @core.string-concat(left: $6, right: $7), right: $8), right: "="),
            false =>
              @core.string-concat(
                left: @core.string-concat(left: @core.string-concat(left: @core.string-concat(left: $6, right: $7), right: $8), right: $9),
                right: ""
              )
          }
      }
  }
visibility
public
std.bytes-to-base64-group (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: e6gPb7zDEY43FJR2cYheN7qaj97PbV1MFstLj8dP5yI
content hash: HPakPLzcSbMrCZbztu1Cun7UNbXWfyy5MJh5kfzMa6g