metaline

1.1.0 • Public • Published

metaline

A tiny language to write mapping functions as strings.

Install

npm i metaline

Example syntax

The string where.id.in.$>#id;limit:99 generates the equivalent function of:

function transform (input) {
  return {
    where: {
      id: {
        in: input.map((i) => i.id)
      }
    },
    limit: 99
  }
}

The string $>id.#directoryId generates the equivalent function of:

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    116,774
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    116,774
  • 1.0.0
    1

Package Sidebar

Install

npm i metaline

Weekly Downloads

116,775

Version

1.1.0

License

Apache-2.0

Unpacked Size

18.4 kB

Total Files

6

Last publish

Collaborators

  • matteo.collina