remarks param src param delim param includeDelim export function * split ( src , delim = /\r?\n/g , includeDelim = false ) { let i = 0 ; const n = src . length ; const include = ~ ~ includeDelim ; const re = typeof delim === "string" ? new RegExp ( delim , "g" ) : delim ; for ( ; i < n ; ) { const m = re . exec ( src ) ; if ( ! m ) { yield src . substring ( i ) ; return ; } const len = m [ 0 ] . length ; yield src . substring ( i , m . index + include * len ) ; i = m . index + len ; } }