resolvewithplus
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "resolvewithplus", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license" : "MIT", | ||
@@ -5,0 +5,0 @@ "main": "src/resolvewithplus.js", |
// Filename: resolvewithplus.js | ||
// Timestamp: 2016.02.19-10:28:39 (last modified) | ||
// Timestamp: 2017.01.07-23:42:02 (last modified) | ||
// Author(s): bumblehead <chris@bumblehead.com> | ||
@@ -53,7 +53,8 @@ | ||
o.isdirpath = function (p) { | ||
return /^\.?\.?\//.test(p); | ||
return /^\.?\.?(\/|\\)/.test(p); | ||
}; | ||
o.isrelpath = function (p) { | ||
return /^.\.?(?=\/)/.test(p); | ||
return /^.\.?(?=\/)/.test(p) | ||
|| /^.\.?(?=\\)/.test(p); | ||
}; | ||
@@ -161,3 +162,3 @@ | ||
var temppath; | ||
if (o.isrelpath(requirepath)) { | ||
@@ -199,3 +200,3 @@ temppath = path.join(withpath, requirepath); | ||
if (parts[x]) { | ||
packagejsonpath = join('/', join.apply(x, parts.slice(0, x + 1)), 'package.json'); | ||
packagejsonpath = join(path.sep, join.apply(x, parts.slice(0, x + 1)), 'package.json'); | ||
if (o.isfilesync(packagejsonpath)) { | ||
@@ -247,4 +248,10 @@ packagejson = require(packagejsonpath); | ||
if (parts[x]) { | ||
dirarr.push(join('/', join.apply(x, parts.slice(0, x + 1)), 'node_modules')); | ||
dirarr.push(join('/', join.apply(x, parts.slice(0, x + 1)), 'bower_components')); | ||
if (path.sep === '/') { | ||
dirarr.push(join(path.sep, join.apply(x, parts.slice(0, x + 1)), 'node_modules')); | ||
dirarr.push(join(path.sep, join.apply(x, parts.slice(0, x + 1)), 'bower_components')); | ||
} else { | ||
// windows stuff | ||
dirarr.push(path.resolve(join(join.apply(x, parts.slice(0, x + 1)), 'node_modules'))); | ||
dirarr.push(path.resolve(join(join.apply(x, parts.slice(0, x + 1)), 'bower_components'))); | ||
} | ||
} | ||
@@ -251,0 +258,0 @@ } |
// Filename: resolvewithplus.spec.js | ||
// Timestamp: 2016.02.12-17:06:52 (last modified) | ||
// Timestamp: 2017.01.07-23:40:31 (last modified) | ||
// Author(s): bumblehead <chris@bumblehead.com> | ||
var resolvewithplus = require('../src/resolvewithplus'), | ||
resolvewith = resolvewithplus, | ||
path = require('path'); | ||
describe("resolvewithplus", function () { | ||
/* | ||
it("should return the path to a bower module file", function () { | ||
expect( | ||
resolvewithplus('bowercomponent', './test/resolvewithplus.spec.js', { browser : true }) | ||
).toBe( | ||
path.resolve('./test/bower_components/bowercomponent/src/bower-component.js') | ||
); | ||
}); | ||
it("should return the path to a bower module file", function () { | ||
expect( | ||
resolvewithplus('bowercomponentbrowser', './test/resolvewithplus.spec.js') | ||
).toBe( | ||
path.resolve('./test/bower_components/bowercomponentbrowser/src/bower-component.js') | ||
); | ||
}); | ||
it("should return the path to a bower module's browser file", function () { | ||
expect( | ||
resolvewithplus('bowercomponentbrowser', './test/resolvewithplus.spec.js', { browser : true }) | ||
).toBe( | ||
path.resolve('./test/bower_components/bowercomponentbrowser/src/bower-component-browser.js') | ||
); | ||
}); | ||
*/ | ||
}); | ||
// | ||
@@ -41,4 +12,4 @@ // should pass resolve with tests as well | ||
var resolvewith = resolvewithplus; | ||
describe("resolvewith", function () { | ||
@@ -144,7 +115,1 @@ it("should return a core module reference as require.resolve id", function () { | ||
}); | ||
describe("resolvewith.getasdirname", function () { | ||
it("should return a relative path as a fullpath", function () { | ||
expect( /^\/.*relpath$/.test(resolvewith.getasdirname('./relpath')) ).toBe(true); | ||
}); | ||
}); |
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
14164
322