{"version":3,"sources":["jsdelivr-header.js","/Users/kevin/Dev/OpenSource/iterators/newline-iterator/src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,yOCcA,W,oCAAwB,e,IApBxB,IAAM,eAAiB,YAEjB,KAAyB,oBAAX,OAAyB,OAAS,OAEhD,YAAmD,IAAhB,KAAK,OAA0B,CAAE,cAAU,GAA+C,KAAK,OAgBzH,SAAS,gBAAgB,GACtC,IAAM,EAAQ,EAAO,MAAM,gBAAgB,UAY3C,OAJE,iBAAA,CANA,gBACE,GAAqB,IAAjB,EAAM,OAAc,MAAO,CAAE,MAAO,KAAM,MAAM,GACpD,IAAM,EAAQ,EAAM,MACpB,OAAqB,IAAjB,EAAM,QAAiC,IAAjB,EAAM,OAAqB,CAAE,MAAO,KAAM,MAAM,GACnE,CAAE,QAAO,MAAM,EACxB,GACC,OAAO,UAAR,WACE,OAAO,IACT,GAGJ,C","file":"/npm/newline-iterator@1.0.11/dist/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/newline-iterator@1.0.11/dist/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const REGEX_NEW_LINE = /\\r?\\n|\\r/g;\n\nconst root = typeof window === 'undefined' ? global : window;\n// biome-ignore lint/suspicious/noShadowRestrictedNames: Legacy\nconst Symbol: SymbolConstructor = typeof root.Symbol === 'undefined' ? ({ iterator: undefined } as unknown as SymbolConstructor) : root.Symbol;\n\n/**\n * Create a newline iterator recognizing CR, LF, and CRLF using the Symbol.iterator interface\n *\n * @param string The string to iterate through\n *\n * ```typescript\n * import newlineIterator from \"newline-iterator\";\n *\n * const iterator = newlineIterator(\"some\\r\\nstring\\ncombination\\r\");\n * const results = [];\n * for (const line of iterator) results.push(line);\n * console.log(results); // [\"some\", \"string\", \"combination\"];\n * ```\n */\nexport default function newlineIterator(string: string): IterableIterator<string> {\n  const lines = string.split(REGEX_NEW_LINE).reverse();\n  const iterator = {\n    next(): IteratorResult<string, boolean> {\n      if (lines.length === 0) return { value: null, done: true };\n      const value = lines.pop();\n      if (lines.length === 0 && value.length === 0) return { value: null, done: true };\n      return { value, done: false };\n    },\n    [Symbol.iterator](): Iterator<string> {\n      return this;\n    },\n  };\n  return iterator as IterableIterator<string>;\n}\n"]}