Here is an exmaple of the code which will teleport Error from the place it should be handled to the place it whouldn't occur.
const target = new EventTarget()
target.addEventListener('event', () => {
throw new Error('Some error')
})| // 1. Функции, которые выполняют деление в синхронном и асинхронном стиле | |
| function divide(a, b) { | |
| if (b < 0) { | |
| throw new Error('Divisin by zero') | |
| } | |
| return a / b | |
| } |
| export default ({define, it}: Testup.ScriptScope) => { | |
| } |
| debug() { | |
| echo "IT'S A TRAP: $BASH_COMMAND" | |
| } | |
| trap 'debug' DEBUG | |
| echo 'HELLO' |
| #!/bin/bash | |
| SSH_DIR=$HOME/.ssh/ | |
| AUTH_KEYS_DIR=${SSH_DIR}/authorized_keys.d | |
| AUTH_KEYS_FILE=${SSH_DIR}/authorized_keys | |
| # Utils | |
| key-path() { | |
| echo "${AUTH_KEYS_DIR}/${1}" |
| type AbstractConstructorHelper<T> = (new (...args: any) => {}) & T; | |
| type Extension = Record<string, {[key in 'method']: unknown}> | |
| type Schematic<T extends Extension> = { | |
| -readonly [K in keyof T]: T[K]['method'] | |
| } | |
| type Mixin<T, S extends Extension> = (new (...args: ConstructorParameters<AbstractConstructorHelper<T>>) => InstanceType<AbstractConstructorHelper<T>> & Schematic<S>) & T; |
| pragma solidity ^0.6.0; | |
| contract Lists { | |
| mapping(uint => uint[]) public list; | |
| function add(uint id, uint value) | |
| public | |
| { | |
| list[id].push(value); | |
| } |
| import escapeRegex from 'escape-regexp' | |
| // Tokens | |
| const T_TEXT = 1 | |
| const T_PATTERN = 2 | |
| const T_LIST = 3 | |
| const patternRe = /\[(?<marker>\+|\/|:)(?<id>[A-Za-z0-9_-]+)\]/y | |
| const listRe = /\[(?<id>[A-Za-z0-9_-]+):(?<list>(\S+(\|\S+)*))\]/y |