chi-datapackage
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -9,2 +9,5 @@ CHANGELOG | ||
## 3.0.1 (2016-08-24) | ||
* Ensure paths are always POSIX | ||
## 3.0.0 (2016-08-19) | ||
@@ -11,0 +14,0 @@ * Assign cuid to resources without name |
@@ -5,7 +5,14 @@ 'use strict'; | ||
var path = require('path'); | ||
var readFile = require('fs').readFile; | ||
var debug = require('debug')('fetch'); | ||
function fetchTextFromURL(url) { | ||
debug('fecthing', url); | ||
if (url.indexOf('file://') === 0) { | ||
url = url.replace('file://', ''); | ||
if (path.sep === '\\') { | ||
url = path.normalize(url).replace(/^\\/, ''); | ||
} | ||
return new Promise(function (resolve, reject) { | ||
@@ -29,4 +36,2 @@ readFile(url, 'utf8', function (err, res) { | ||
// TODO: Browser | ||
module.exports = fetchTextFromURL; |
@@ -8,2 +8,3 @@ 'use strict'; | ||
var debug = require('debug')('Loader'); | ||
var parse = require('json5').parse; | ||
@@ -26,3 +27,9 @@ | ||
} | ||
return require('path').resolve; | ||
var path = require('path'); | ||
return function (url) { | ||
url = path.resolve(url) // ensures path is absolute | ||
.replace(/\\/g, '/'); // ensures path is POSIX, ready to be a url | ||
return url[0] === '/' ? url : '/' + url; | ||
}; | ||
}(); | ||
@@ -29,0 +36,0 @@ |
{ | ||
"name": "chi-datapackage", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Normalize datapackage and datapackage resources", | ||
@@ -77,3 +77,3 @@ "main": "index.js", | ||
"d3-time-format": "^2.0.2", | ||
"datapackage-identifier": "^0.4.1", | ||
"datapackage-identifier": "^0.4.2", | ||
"debug": "^2.2.0", | ||
@@ -80,0 +80,0 @@ "deep-extend": "^0.4.1", |
require('isomorphic-fetch'); | ||
const path = require('path'); | ||
const readFile = require('fs').readFile; | ||
const debug = require('debug')('fetch'); | ||
function fetchTextFromURL (url) { | ||
debug('fecthing', url); | ||
if (url.indexOf('file://') === 0) { | ||
url = url.replace('file://', ''); | ||
if (path.sep === '\\') { | ||
url = path.normalize(url).replace(/^\\/, ''); | ||
} | ||
return new Promise((resolve, reject) => { | ||
@@ -27,4 +34,2 @@ readFile(url, 'utf8', (err, res) => { | ||
// TODO: Browser | ||
module.exports = fetchTextFromURL; |
'use strict'; | ||
const debug = require('debug')('Loader'); | ||
const parse = require('json5').parse; | ||
@@ -21,3 +22,10 @@ | ||
} | ||
return require('path').resolve; | ||
const path = require('path'); | ||
return url => { | ||
url = path | ||
.resolve(url) // ensures path is absolute | ||
.replace(/\\/g, '/'); // ensures path is POSIX, ready to be a url | ||
return (url[0] === '/') ? url : `/${url}`; | ||
}; | ||
})(); | ||
@@ -24,0 +32,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53345
1426