File size: 788 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.indexOf = indexOf;
exports.lastIndexOf = lastIndexOf;
exports.getWithLoc = getWithLoc;
/** indexOf */
function indexOf(str, search, start, end) {
const endIndex = end !== null && end !== void 0 ? end : str.length;
for (let index = start; index < endIndex; index++) {
const c = str[index];
if (search(c, index)) {
return index;
}
}
return -1;
}
/** lastIndexOf */
function lastIndexOf(str, search, end) {
for (let index = end; index >= 0; index--) {
const c = str[index];
if (search(c, index)) {
return index;
}
}
return -1;
}
/** Get node with location */
function getWithLoc(node) {
return node;
}
|