Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

decypher

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decypher - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

index.js

18

package.json
{
"name": "decypher",
"version": "0.1.2",
"description": "Yesql-like cypher query loader for node.js",
"main": "decypher.js",
"version": "0.2.0",
"description": "A handful of cypher utilities for Node.js",
"main": "index.js",
"scripts": {
"test": "mocha -R spec ./test/unit.js"
"test": "mocha -R spec ./test"
},

@@ -15,3 +15,7 @@ "repository": {

"cypher",
"neo4j"
"neo4j",
"query builder",
"query",
"builder",
"batch"
],

@@ -26,3 +30,7 @@ "author": "Yomguithereal",

"mocha": "^2.1.0"
},
"dependencies": {
"lodash.assign": "^3.2.0",
"lodash.isplainobject": "^3.2.0"
}
}

@@ -5,6 +5,9 @@ [![Build Status](https://travis-ci.org/Yomguithereal/decypher.svg)](https://travis-ci.org/Yomguithereal/decypher)

**decypher** is a node.js library aiming at loading [cypher](http://neo4j.com/developer/cypher-query-language/) queries from external files so you can use them later in your code.
**decypher** is a node.js library packing a handful of utilities to deal with [cypher](http://neo4j.com/developer/cypher-query-language/) queries.
The library's philosophy is quite similar to the Clojure [Yesql](https://github.com/krisajenkins/yesql)'s one.
It includes the following:
* A [Yesql](https://github.com/krisajenkins/yesql)-like [query loader](#query-loader).
* A simple [query builder](#query-builder).
## Installation

@@ -24,3 +27,3 @@

## Usage
## Query loader

@@ -55,3 +58,3 @@ ### Query files

To load you queries, just require **decypher** and use it to load your queries:
Just require **decypher** and use it to load your queries:

@@ -104,2 +107,41 @@ ```js

## Query builder
Note that this query builder is widely inspired by the [query-builder](https://github.com/shesek/cypher-query) package by [@shesek](https://github.com/shesek) but fixed and updated to support cypher's latest evolutions.
```js
var cypher = require('decypher').builder;
// Creating a query
var query = cypher()
.match('MATCH (n:Node)')
.where('n.title = {title}', {title: 'The best title'})
.return('n');
// Compiling to string
query.compile();
// or
query.toString();
// MATCH (n:Node)
// WHERE n.title = {title}
// RETURN n;'
// Retrieving the query's parameters
query.params();
>>> {
title: 'The best title'
}
// Note that multi words statements like `ORDER BY`
// have to be written in camel-case:
query.orderBy('n.title');
// You can also set a bunch of params at once
query.params({whatever: 'is needed'});
// Finally, you can add arbitrary parts to the query if required
query.add('anything you want');
query.add('with {param}', {param: 'heart'});
```
## Contribution

@@ -119,1 +161,10 @@

```
## Roadmap
* Some helpers
* A batch
## License
[MIT](LICENSE.txt)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc