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
- Host: GitHub
- URL: https://github.com/gnlow/yamlow
- Owner: gnlow
- License: mit
- Created: 2021-01-16T11:35:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-16T14:09:08.000Z (over 5 years ago)
- Last Synced: 2024-12-30T14:48:42.522Z (over 1 year ago)
- Language: TypeScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
]
}
```