https://github.com/platformatic/metaline
A tiny language to write mapping functions as strings
https://github.com/platformatic/metaline
Last synced: 7 months ago
JSON representation
A tiny language to write mapping functions as strings
- Host: GitHub
- URL: https://github.com/platformatic/metaline
- Owner: platformatic
- License: apache-2.0
- Created: 2023-12-05T18:17:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-11T15:57:07.000Z (7 months ago)
- Last Synced: 2025-08-18T07:45:44.053Z (7 months ago)
- Language: JavaScript
- Size: 42 KB
- Stars: 17
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# metaline
A tiny language to write mapping functions as strings.
## Install
```bash
npm i metaline
```
## Example syntax
The string `where.id.in.$>#id;limit:99` generates the equivalent function of:
```js
function transform (input) {
return {
where: {
id: {
in: input.map((i) => i.id)
}
},
limit: 99
}
}
```
The string `$>id.#directoryId` generates the equivalent function of:
```js
function transform (input) {
return input.map((t) => {
return {
id: t.directoryId
}
})
}
```
## Language Tokens
* `.` separate properties in an object
* `$` the input
* `$>` loop over the input
* `#` access the following input property
## License
Apache-2.0