mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-10 07:37:35 +02:00
Fix:Include Watcher as lib with no dependencies and fix tiny-readdir bug #610
This commit is contained in:
17
server/libs/watcher/string-indexes.js
Normal file
17
server/libs/watcher/string-indexes.js
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
/* STRING INDEXES */
|
||||
function indexes(str, substr) {
|
||||
var indexes = [], rangeLength = substr.length;
|
||||
var indexFrom = 0;
|
||||
while (true) {
|
||||
var index = str.indexOf(substr, indexFrom);
|
||||
if (index === -1)
|
||||
return indexes;
|
||||
indexes.push(index);
|
||||
indexFrom = index + rangeLength;
|
||||
}
|
||||
}
|
||||
/* EXPORT */
|
||||
module.exports = indexes;
|
||||
module.exports.default = indexes;
|
||||
Object.defineProperty(module.exports, "__esModule", { value: true });
|
Reference in New Issue
Block a user