An open API service indexing awesome lists of open source software.

https://github.com/gnlow/yamlow

Use JSON/YAML as programming language
https://github.com/gnlow/yamlow

Last synced: 6 months ago
JSON representation

Use JSON/YAML as programming language

Awesome Lists containing this project

README

          

# yamlow
Use JSON/YAML as programming language
```ts
import type { Operator } from "https://denopkg.com/gnlow/yamlow@main/mod.ts"

const operatorFuncs = {
"==": (a: any, b: any) => a == b,
">=": (a: number, b: number) => a >= b,
"<=": (a: number, b: number) => a <= b,
"square": (a: number) => a ** 2
}

type Fs = typeof operatorFuncs

const a: Operator = { // No error
"==": [0, 1]
}

const b: Operator = { // Error occur (An operator should have only one key.)
"==": [0, 1],
"<=": [1, 2],
}

const c: Operator = { // Error occur ("==" operator needs 2 parameters.)
"==": [0]
}

const d: Operator = { // No error
square: 2
}

const e: Operator = { // No error
"==": [
{square: {square: 2}},
16
]
}
```