# zer

> Generate Gremlin queries by chaining JavaScript function calls

Latest version **0.1.0** (published 2017-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install zer
pnpm add zer
yarn add zer
bun add zer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-05-17 |
| First published | 2016-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 9 |
| Author | Jean-Baptiste Musso |
| Maintainers | jbmusso |
| Keywords | gremlin, tinkerpop, graphdb, graph, database, dsl, proxy, generate, serializer, serialization, sql, groovy |

## Links

- npm: https://www.npmjs.com/package/zer
- Repository: https://github.com/jbmusso/zer
- Homepage: https://github.com/jbmusso/zer#readme
- Issues: https://github.com/jbmusso/zer/issues
- npm.io page: https://npm.io/package/zer

## Dependencies (1)

- [postinstall-build](https://npm.io/package/postinstall-build.md) ^5.0.0

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2017-05-17
- 0.0.0 — 2016-06-20

## README

# zer

Zer helps you serialize any JavaScript chains to String representations of any languages by leveraging ES2015 `Proxy` objects.

## Installation

```shell
npm install zer
```

## Usage

Zer is currently useful for generating Gremlin-Groovy graph database queries.

```javascript

import { createChainCreator } from 'zer';

import { toGroovy } from 'zer/src/groovy';
import { STRATEGY } from 'zer/src/chain';

const Objects = createChainCreator(STRATEGY, toGroovy);

const { g, out, has } = Objects;

const chain = g.V().has('name', 'Alice').repeat(out('knows')).until(has('name', 'Bob'));

console.log(chain.__repr__());
// g.V().has('name', 'Alice').repeat(out('knows')).until(has('name', 'Bob'))
```

## Argument escaping

Zer allows you to output Objects, not just Strings. This is especially useful when you wish to escape some arguments from your chain, such as when creating a DSL for a database client (SQL, Gremlin...).

```javascript
const chain = g.V().has('name', 'Alice').repeat(out('knows')).until(has('name', 'Bob'));

console.log(chain.__repr__())

/*
 { query: 'g.V().has(p0, p1).has(p2, p3).repeat(out(p4, p5))',
  params:
   { p0: 'name',
     p1: 'Alice',
     p2: 'age',
     p3: 30,
     p4: 'firstname',
     p5: 'Bob' }
*/
```

---
_Source: https://npm.io/package/zer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
