UNPKG

neo4j

Version:

Neo4j driver (REST API client) for Node.js

60 lines (50 loc) 1.76 kB
// Generated by CoffeeScript 1.8.0 (function() { var Node, utils; utils = require('./utils'); module.exports = Node = (function() { function Node(opts) { if (opts == null) { opts = {}; } this._id = opts._id, this.labels = opts.labels, this.properties = opts.properties; } Node.prototype.equals = function(other) { return (other instanceof Node) && (this._id === other._id); }; Node.prototype.toString = function() { var labels; labels = this.labels.map(function(label) { return ":" + label; }); return "(" + this._id + (labels.join('')) + ")"; }; Node._fromRaw = function(obj) { var data, id, labels, metadata, self; if ((!obj) || (typeof obj !== 'object')) { return null; } data = obj.data, metadata = obj.metadata, self = obj.self; if ((!self) || (typeof self !== 'string') || (!data) || (typeof data !== 'object')) { return null; } if (metadata) { id = metadata.id, labels = metadata.labels; } else { id = utils.parseId(self); labels = null; if (!this._warnedMetadata) { this._warnedMetadata = true; console.warn('It looks like you’re running Neo4j <2.1.5. Neo4j <2.1.5 didn’t return label metadata to drivers, so node-neo4j has no way to associate nodes with labels. Thus, the `labels` property on node-neo4j `Node` instances will always be null for you. Consider upgrading to fix. =) http://neo4j.com/release-notes/neo4j-2-1-5/'); } } return new Node({ _id: id, labels: labels, properties: data }); }; return Node; })(); }).call(this); //# sourceMappingURL=Node.js.map