Explorer

definy.split-account-ids

description
Split a list of account IDs separated by commas, semicolons or spaces (DEFINY_ADMIN_ACCOUNT_IDS) from index, appending to acc. current is the ID being read
type
Fn(text: String, index: Number, current: String, acc: List<String>) -> List<String>
expression
fn(text$0, index$1, current$2, acc$3) =>
  let flushed$4 = match @core.equal(left: $2, right: "") {
      true =>
        $3,
      false =>
        @core.list-append(list: $3, item: $2)
    };
  match @core.less-than(left: $1, right: @core.string-length(value: $0)) {
    false =>
      $4,
    true =>
      let character$5 = @core.string-slice(value: $0, start: $1, end: @core.plus(left: $1, right: 1));
      match @core.or(
          left: @definy.is-space(character: $5),
          right: @core.or(left: @core.equal(left: $5, right: ","), right: @core.equal(left: $5, right: ";"))
        ) {
        true =>
          @definy.split-account-ids(text: $0, index: @core.plus(left: $1, right: 1), current: "", acc: $4),
        false =>
          @definy.split-account-ids(
            text: $0,
            index: @core.plus(left: $1, right: 1),
            current: @core.string-concat(left: $2, right: $5),
            acc: $3
          )
      }
  }
visibility
public
definy.split-account-ids (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: 9v096gpmpnzdb1Hdla8BsXpxjBinxB-_46nb_AcJTMQ
content hash: J6mvR_VvC5jhg7wnaf_RYJZMkDegYi28zM7GRcKPjQ4