{"version":3,"file":"index.cjs","sources":["../src/startsWith.js","../src/bruteForce.js","../src/index.js"],"sourcesContent":["import assert from 'assert';\n\n/**\n * Checks that the second input string matches the first input string at the\n * given offsets. Undefined behavior if one of the strings is not long enough.\n *\n * @param {string} p\n * @param {number} pi\n * @param {number} pj\n * @param {string} s\n * @param {number} si\n *\n * @return {boolean}\n */\nconst startsWith = (p, pi, pj, s, si) => {\n\tassert(typeof p === 'string');\n\tassert(pi >= 0 && pj <= p.length);\n\tassert(typeof s === 'string');\n\tassert(si >= 0 && si + (pj - pi) <= s.length);\n\tfor (; pi < pj; ++pi, ++si) {\n\t\tif (p[pi] !== s[si]) return false;\n\t}\n\n\treturn true;\n};\n\nexport default startsWith;\n","import startsWith from './startsWith.js';\n\n/**\n * Find.\n *\n * @param {string} s\n * @param {number} si\n * @param {number} sj\n * @param {string} p\n * @param {number} pi\n * @param {number} pj\n * @return {IterableIterator<number>}\n */\nexport default function* bruteForce(s, si, sj, p, pi, pj) {\n\tconst m = pj - pi;\n\tconst sk = sj - m;\n\n\tfor (; si <= sk; ++si) {\n\t\tif (startsWith(p, pi, pj, s, si)) yield si;\n\t}\n}\n","import bruteForce from './bruteForce.js';\n\nexport const findAll = bruteForce;\nexport {default as startsWith} from './startsWith.js';\n"],"names":["p","pi","pj","s","si","bruteForce","sj","sk","startsWith"],"mappings":"AAcA,MAAmB,SAACA,EAAGC,EAAIC,EAAIC,EAAGC,GAKjC,KAAOH,EAAKC,IAAMD,IAAMG,EACvB,GAAIJ,EAAEC,KAAQE,EAAEC,GAAK,SAGtB,oCCVwBC,YAAAA,EAAWF,EAAGC,EAAIE,EAAIN,EAAGC,EAAIC,wFAE/CK,EAAKD,GADDJ,EAAKD,eAGRG,GAAMG,uBACRC,EAAWR,EAAGC,EAAIC,EAAIC,EAAGC,mBAAK,gBAAMA,EAL3B,SAIKA,uECfGC"}