Code coverage report for src/index.js

Statements: 70.73% (29 / 41)      Branches: 50% (2 / 4)      Functions: 50% (1 / 2)      Lines: 70.73% (29 / 41)      Ignored: none     

All files » src/ » index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71              1   8   8                                 8   8   8 8 8 8 8   8 8 8       8 8 8 8 8       1 1 1 1 1 1 1 1   1       1 1        
// # Neo4jMapper
// **(c) 2013 by Philipp Ständer <philipp.staender@gmail.com>**
//
// *Distributed under the GNU General Public License*
//
// Neo4jMapper is an **object mapper for neo4j databases**.
 
var Neo4jMapper = function Neo4jMapper(urlOrOptions) {
 
  var _client_ = null;
 
  Iif (typeof window === 'object') {
    // Browser
    var Neo4jRestful  = this.Neo4jRestful  = window.Neo4jMapper.initNeo4jRestful(urlOrOptions);
 
    this.client = _client_ = new Neo4jRestful();
 
    this.Graph         = window.Neo4jMapper.initGraph(_client_);
    this.Transaction   = window.Neo4jMapper.initTransaction(_client_, this.Graph);
    this.Node          = window.Neo4jMapper.initNode(_client_, this.Graph);
    this.Relationship  = window.Neo4jMapper.initRelationship(_client_, this.Graph, this.Node);
    this.Path          = window.Neo4jMapper.initPath(_client_, this.Graph);
 
    this.helpers = window.Neo4jMapper.helpers;
    this.helpers.ConditionalParameters = window.Neo4jMapper.ConditionalParameters;
    this.helpers.CypherQuery = window.Neo4jMapper.CypherQuery;
  } else {
    // NodeJS
    var Neo4jRestful  = this.Neo4jRestful  = require('./neo4jrestful').init(urlOrOptions);
 
    this.client = _client_ = new Neo4jRestful();
 
    this.Graph         = require('./graph').init(_client_);
    this.Transaction   = require('./transaction').init(_client_);
    this.Node          = require('./node').init(_client_, this.Graph);
    this.Relationship  = require('./relationship').init(_client_, this.Graph, this.Node);
    this.Path          = require('./path').init(_client_, this.Graph);
 
    this.helpers = require('./helpers');
    this.helpers.ConditionalParameters = require('./conditionalparameters');
    this.helpers.CypherQuery = require('./cypherquery');
  }
 
  // create references among the constructors themeselves
  this.Node.Relationship          = this.Relationship;
  this.Relationship.Node          = this.Node;
  this.Neo4jRestful.Node          = this.Node;
  this.Neo4jRestful.Path          = this.Path;
  this.Neo4jRestful.Relationship  = this.Relationship;
 
}
 
Neo4jMapper.prototype.Node = null;
Neo4jMapper.prototype.Relationship = null;
Neo4jMapper.prototype.Graph = null;
Neo4jMapper.prototype.Transaction = null;
Neo4jMapper.prototype.Path = null;
Neo4jMapper.prototype.Neo4jRestful = null;
Neo4jMapper.prototype.client = null;
Neo4jMapper.prototype.helpers = null;
 
Neo4jMapper.init = function(urlOrOptions) {
  return new Neo4jMapper(urlOrOptions);
}
 
Eif (typeof window !== 'object') {
  module.exports = exports = Neo4jMapper;
} else {
  window.Neo4jMapper = Neo4jMapper;
}