Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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