Skip to content

Commit

Permalink
Check array items for surrogate methods (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston authored May 2, 2022
1 parent e05c621 commit 80a5ce3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ open class SurrogatesUserScript: NSObject, UserScript {
return ""
}
let instructionsRow = codeLines.removeFirst()
let pattern = instructionsRow.split(separator: " ")[0].split(separator: "/")[1]
guard let path = instructionsRow.split(separator: " ").first,
let pattern = path.split(separator: "/").last else {
return ""
}
let stringifiedFunction = codeLines.joined(separator: "\n")
return "surrogates['\(pattern)'] = function () {\(stringifiedFunction)}"
}
Expand Down

0 comments on commit 80a5ce3

Please sign in to comment.