** PROBLEM **
I need to set a long integer value in a vertex from my JavaScript/TypeScript code.
** WHY IS THIS AN ISSUE? **
JavaScript stores number
as a double
in Java or C# world as we can see in the following example:
public static async experiment(): Promise<any> {
const g = GremlinDb.g;
await g.addV("test")
.property("number", 3).iterate();
return {};
}
Use toLong()
in exports.toLong
in gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
public static async experiment(): Promise<any> {
const g = GremlinDb.g;
await g.addV("test")
.property("number", toLong(3)).iterate();
return {};
}