How to use the neo4j-driver.v1.isInt function in neo4j-driver

To help you get started, we’ve selected a few neo4j-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jabher / agregate / agregate / connection / driver / driver.js View on Github external
rehydrate(value: any): any {
    if (Array.isArray(value)) {
      // noinspection JSUnresolvedFunction
      return value.map(entry => this.rehydrate(entry))
    }
    if (value instanceof neo4j.types.Node) {
      return this.rehydrateNode(value)
    }
    if (value instanceof neo4j.types.Relationship) {
      return this.rehydrateRelation(value)
    }
    if (neo4j.isInt(value)) {
      // noinspection JSUnresolvedFunction
      return value.toNumber()
    }
    return value
  }
github brikteknologier / seraph / lib / bolt / seraph.js View on Github external
return new Promise((resolve, reject) => {
      if (neo4j.isInt(obj)) return resolve(obj);
      var id;
      if (requireData) {
        id = typeof obj == 'object' ? obj[this.options.id] : undefined;
      } else {
        id = typeof obj == 'object' ? obj[this.options.id] : obj;
      }

      if (id != null) id = parseInt(id, 10);
      if (isNaN(id) || id == null) return reject(new Error("Invalid ID"));
      resolve(neo4j.int(id));
    });
  }
github jamesfer / cypher-query-builder / src / transformer.ts View on Github external
private transformValue(value: any): any {
    if (this.isPlainValue(value)) {
      return value;
    }
    if (isArray(value)) {
      return map(value, v => this.transformValue(v));
    }
    if (neo4j.isInt(value)) {
      return this.convertInteger(value);
    }
    if (this.isNode(value)) {
      return this.transformNode(value);
    }
    if (this.isRelation(value)) {
      return this.transformRelation(value);
    }
    if (typeof value === 'object') {
      return mapValues(value, v => this.transformValue(v));
    }
    return null;
  }
github neo4j-apps / neuler / src / services / resultMapper.js View on Github external
return Object.keys(properties).reduce((props, propKey) => {
    let value = properties[propKey]

    if (neo.isInt(value)) {
      props[propKey] = value.toNumber()
    } else if (Array.isArray(value)) {
      props[propKey] = value.map(item => item.toString()).join(', ')
    } else if(neo.isDate(value) || neo.isDateTime(value) || neo.isDuration(value) || neo.isLocalDateTime(value) || neo.isLocalTime(value)) {
      props[propKey] = value.toString()
    } else {
      props[propKey] = value
    }

    return props
  }, {})
}
github brikteknologier / seraph / lib / bolt / seraph.js View on Github external
var treatObj = obj => {
      if (typeof obj == 'number') return pr(obj % 1 === 0 ? neo4j.int(obj) : obj);
      else if (obj instanceof Promise) return obj.then(val => treatObj(val));
      else if (neo4j.isInt(obj)) return pr(obj);
      else if (Array.isArray(obj)) return Promise.all(obj.map(treatObj));
      else if (typeof obj == 'object' && obj !== null) 
        return Promise.all(_.map(obj, (v,k) => { return treatObj(v).then(v => [k,v]) }))
          .then(tuples => _.object(tuples))
      else return pr(obj);
    }
    return params ? treatObj(params) : pr(params);
github al66 / imicros-flow / lib / connector / neo4j.js View on Github external
transform(object) {
        for (let property in object) {
            if (object.hasOwnProperty(property)) {
                const propertyValue = object[property];
                if (db.isInt(propertyValue)) {
                    if (db.integer.inSafeRange(propertyValue)) {
                        object[property] = propertyValue.toNumber();
                    } else {
                        object[property] = propertyValue.toString();
                    }
                } else if (typeof propertyValue === "object") {
                    this.transform(propertyValue);
                }
            }
        }
    }
github brikteknologier / seraph / lib / bolt / seraph.js View on Github external
var assemble = (field) => {
      if (Array.isArray(field)) return field.map(assemble);
      else if (typeof field != 'object' || !field) return field;
      else if (neo4j.isInt(field)) return this._unboxInt(field);
      else if (field instanceof neo4j.types.Node) {
        var obj = field.properties;
        if (this.options.label) obj.labels = field.labels;
        obj[this.options.id] = this._unboxInt(field.identity);
        return this._unboxAll(obj);
      }
      else if (field instanceof neo4j.types.Relationship) {
        field.start = this._unboxInt(field.start);
        field.end = this._unboxInt(field.end);
        field[this.options.id] = this._unboxInt(field.identity);
        if (this.options.id != 'identity') delete field.identity;
        field.properties = this._unboxAll(field.properties);
        return field;
      }
      else if (field instanceof neo4j.types.UnboundRelationship ||
               field instanceof neo4j.types.PathSegment ||