UNPKG

quick-erd

Version:

quick and easy text-based ERD + code generator for migration, query, typescript types and orm entity

12 lines (11 loc) 461 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.firstIndexOf = firstIndexOf; /** Find the first occurrence of any pattern, returns -1 if none found */ function firstIndexOf(string, patterns, offset = 0) { const index_list = patterns .map(pattern => string.indexOf(pattern, offset)) .filter(index => index !== -1) .sort((a, b) => a - b); return index_list.length === 0 ? -1 : index_list[0]; }