(text: js_data, search: str)
| 76 | |
| 77 | |
| 78 | def search_js(text: js_data, search: str) -> list[js_search_data]: |
| 79 | output = [] |
| 80 | for data in text.children: |
| 81 | if type(data) is js_data: |
| 82 | output.extend(search_js(data, search)) |
| 83 | for key in range(len(text.children)): |
| 84 | data = text.children[key] |
| 85 | if data == search: |
| 86 | output.append(js_search_data()) |
| 87 | output[-1].children = text.children |
| 88 | output[-1].parent = text |
| 89 | if len(text.children) > key + 1: |
| 90 | output[-1].after = text.children[key + 1] |
| 91 | if len(text.children) > 0: |
| 92 | output[-1].before = text.children[key - 1] |
| 93 | output[-1].data = search |
| 94 | break |
| 95 | return output |
| 96 | |
| 97 | |
| 98 | def search_js_reg(text: js_data, search: str) -> list[js_search_data]: |
no test coverage detected