'use strict';

var OCL = require('openchemlib');

module.exports = function getConnectivityMatrix(options={}) {
    var {
        sdt,
        mass
    } = options;

    this.ensureHelperArrays(OCL.Molecule.cHelperNeighbours);
    var nbAtoms=this.getAllAtoms();
    var result=new Array(nbAtoms);
    for (var i=0; i<nbAtoms; i++) {
        result[i]=new Array(nbAtoms).fill(0);
        result[i][i]=(mass) ? OCL.Molecule.cRoundedMass[this.getAtomicNo(i)] : 1;
    }

    for (var i=0; i<nbAtoms; i++) {
        for (var j=0; j<this.getAllConnAtoms(i); j++) {
            result[i][this.getConnAtom(i,j)]=(sdt) ? this.getConnBondOrder(i,j) : 1;
        }
    }
    return result;
}

'use strict';

var OCL = require('openchemlib');

module.exports = function getConnectivityMatrix(options) {
    var options = options || {};
    var sdt=options.sdt;
    var mass=options.mass;

    this.ensureHelperArrays(OCL.Molecule.cHelperNeighbours);
    var nbAtoms=this.getAllAtoms();
    var result=new Array(nbAtoms);
    for (var i=0; i<nbAtoms; i++) {
        result[i]=new Array(nbAtoms).fill(0);
        result[i][i]=(mass) ? OCL.Molecule.cRoundedMass[this.getAtomicNo(i)] : 1;
    }

    for (var i=0; i<nbAtoms; i++) {
        for (var j=0; j<this.getAllConnAtoms(i); j++) {
            result[i][this.getConnAtom(i,j)]=(sdt) ? this.getConnBondOrder(i,j) : 1;
        }
    }
    return result;
}

Make it compatible with node 4.0
Make it compatible with node 4.0
