
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
gremlin-script
Advanced tools
Generate Gremlin scripts with ease.
Works in Node.js and the browser.
$ npm install gremlin-script -S
This module works as a CommonJS, AMD module or standalone module (exported globally as GremlinScript
).
Instantiate a script object:
var GremlinScript = require('gremlin-script').GremlinScript;
var gremlin = new GremlinScript();
Get a reference to the graph:
var Graph = require('gremlin-script').Structure.Graph;
var g = new Graph('g'); // pass graph identifier/name to the constructor
var gremlin = new GremlinScript();
gremlin.line('g.v(1)');
gremlin.script.should.equal('g.v(1)\n');
var gremlin = new GremlinScript();
gremlin.line('g.v(%s)', 1);
gremlin.script.should.equal('g.v(p0)\n');
gremlin.params.p0.should.equal(1);
var gremlin = new GremlinScript();
gremlin.line('g.V(%s, %s)', 'name', 'Alice');
gremlin.script.should.equal('g.V(p0, p1)\n');
gremlin.params.p0.should.equal('name');
gremlin.params.p1.should.equal('Alice');
var gremlin = new GremlinScript();
var g = new Graph('g');
gremlin.line(g.v(1));
gremlin.script.should.equal('g.v(1)\n');
Using the bindParameter()
function flags the argument passed to a function as a BoundParameter
. When generating the string, Gremlin-Script will automatically replace such wrapped argument with an automatically generated variable name and push the argument to the gremlin.params
Array.
var bind = require('gremlin-script').bindParameter;
var gremlin = new GremlinScript();
var g = new Graph('g');
var v1 = gremlin.var(g.addVertex(bind({ name: 'Alice' })), 'v1');
var v2 = gremlin.var(g.addVertex(bind({ name: 'Bob' })), 'v2');
gremlin.line(g.addEdge(v1, v2, 'knows', bind({ foo: 'bar' })));
gremlin.script.should.equal("v1=g.addVertex(p0)\nv2=g.addVertex(p1)\ng.addEdge(v1,v2,'knows',p2)\n");
gremlin.params.p0.name.should.equal('Alice');
gremlin.params.p1.name.should.equal('Bob');
gremlin.params.p2.foo.should.equal('bar');
Jean-Baptiste Musso - @jbmusso.
This library was heavily inspired by the great work started by Frank Panetta on gRex. Thanks!
https://github.com/gulthor/gremlin-script/graphs/contributors
MIT (c) 2014 Jean-Baptiste Musso
FAQs
Generate Gremlin scripts with ease
We found that gremlin-script demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.