-
Notifications
You must be signed in to change notification settings - Fork 3
normalize dataset paths #107
Copy link
Copy link
Open
Description
Path normalization was included in the original PoC but was removed at some point.
This allows user to specify dataset path in several ways:
path/to/dataset/datapackage.json
path/to/dataset/
path/to/dataset
Please return it or give reasons for removing it
function getDatapackagePath(path) {
if (!path.endsWith("datapackage.json")) {
if (!path.endsWith("/")) {
path = path + "/";
}
path = path + "datapackage.json";
}
return path;
}
function getBasePath(datapackagePath) {
const dpPathSplit = datapackagePath.split("/");
dpPathSplit.pop();
return dpPathSplit.join("/") + "/";
}
const
datapackagePath = getDatapackagePath(path),
basePath = getBasePath(datapackagePath);
https://github.com/jheeffer/ddfcsv-reader/blob/master/ddfcsv.js#L44-L58
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels