Skip to content

Commit

Permalink
Try to improve clarity in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoFrachet committed Dec 29, 2017
1 parent 7ab29cf commit 2e2e1e4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions helpers/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ function copyUntouchedTable(inputPath, outputPath, tableName, callback) {
function getActualKeysForTable(gtfs, tableName) {
const keys = [...schema.keysByTableName[tableName]];
const deepness = schema.deepnessByTableName[tableName];
let sampleItem = gtfs.getIndexedTable(tableName);
const table = gtfs.getIndexedTable(tableName);
let sampleItem;

if (deepness === 1) {
sampleItem = getSample(sampleItem);
if (deepness === 0) {
sampleItem = table;
} else if (deepness === 1) {
sampleItem = getSample(table);
} else if (deepness === 2) {
sampleItem = getSample(getSample(sampleItem));
sampleItem = getSample(getSample(table));
}

if (sampleItem) {
Expand Down

0 comments on commit 2e2e1e4

Please sign in to comment.