Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/platformatic/metaline
A tiny language to write mapping functions as strings
https://github.com/platformatic/metaline
Last synced: about 1 month 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-04T07:57:34.000Z (12 months ago)
- Last Synced: 2024-05-06T12:24:35.442Z (8 months ago)
- Language: JavaScript
- Size: 23.4 KB
- Stars: 16
- Watchers: 5
- Forks: 0
- Open Issues: 3
-
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