https://github.com/devongovett/fontkit/blob/master/src/tables/directory.js#L47
Per OTS it should be:
this.searchRange = Math.pow(2, Math.floor(Math.log(this.numTables) / Math.LN2)) * 16;
this.entrySelector = Math.floor(Math.log(this.numTables) / Math.LN2);
this.rangeShift = this.numTables * 16 - this.searchRange;