MCPcopy Index your code
hub / github.com/github/docs / lastIndexOfRegex

Function lastIndexOfRegex

script/helpers/remove-liquid-statements.js:251–256  ·  view source on GitHub ↗
(str, regex, fromIndex)

Source from the content-addressed store, hash-verified

249// Hack to use a regex with lastIndexOf.
250// Inspired by https://stackoverflow.com/a/21420210
251function lastIndexOfRegex(str, regex, fromIndex) {
252 const myStr = fromIndex ? str.substring(0, fromIndex) : str
253 const match = myStr.match(regex)
254
255 return match ? myStr.lastIndexOf(match[match.length - 1]) : -1
256}
257
258// Checks if a conditional is necessary given all the supported versions and the arguments in a conditional
259// If all supported versions show up in the arguments, it's not necessary! Additionally, builds in support

Callers 1

removeLiquidStatementsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected